import {
  polygon,
  area,
  point,
  booleanPointInPolygon,
  featureCollection,
  center,
} from "@turf/turf";
import { map, tileLayer, latLng, latLngBounds, rectangle } from "leaflet";
import "leaflet/dist/leaflet.css";
import axios from "axios";
import {
  graphic as graphic$1,
  matrix,
  init,
  registerCoordinateSystem,
  registerAction,
  extendComponentModel,
  extendComponentView,
} from "echarts";
import * as mapv$1 from "mapv";
import { baiduMapLayer as baiduMapLayer$1, DataSet } from "mapv";
var util$1 = {
    cartesianToLnglat: function (cartesian, viewer) {
      var lat;
      return cartesian
        ? ((cartesian = Cesium.Cartographic.fromCartesian(cartesian)),
          (lat = Cesium.Math.toDegrees(cartesian.latitude)),
          [Cesium.Math.toDegrees(cartesian.longitude), lat, cartesian.height])
        : [];
    },
    c32jwd: function (cartesian, viewer) {
      return util$1.cartesianToLnglat(cartesian, viewer);
    },
    cartesiansToLnglats: function (cartesians, viewer) {
      if (cartesians && !(cartesians.length < 1)) {
        if ((viewer = viewer || window.viewer)) {
          for (var arr = [], i = 0; i < cartesians.length; i++)
            arr.push(util$1.cartesianToLnglat(cartesians[i], viewer));
          return arr;
        }
        console.log("util.cartesiansToLnglats方法缺少viewer对象");
      }
    },
    c3s2jwds: function (cartesians, viewer) {
      return util$1.cartesiansToLnglats(cartesians, viewer);
    },
    lnglatsToCartesians: function (lnglats) {
      if (lnglats && !(lnglats.length < 1)) {
        for (var arr = [], i = 0; i < lnglats.length; i++) {
          var c3 = Cesium.Cartesian3.fromDegrees(
            Number(lnglats[i][0]),
            Number(lnglats[i][1]),
            Number(lnglats[i][2] || 0)
          );
          arr.push(c3);
        }
        return arr;
      }
    },
    jwds2c3s: function (cartesians, viewer) {
      return util$1.lnglatsToCartesians(cartesians, viewer);
    },
    flyTo: function (opt, viewer) {
      var center, options;
      viewer
        ? (center = (opt = opt || {}).center)
          ? (delete opt.center,
            (options = {
              duration: opt.duration || 0,
              offset: new Cesium.HeadingPitchRange(
                Cesium.Math.toRadians(opt.heading || 0),
                Cesium.Math.toRadians(opt.pitch || -60),
                opt.range || 1e4
              ),
            }),
            delete opt.heading,
            delete opt.pitch,
            delete opt.range,
            (options = Object.assign(options, opt)),
            center instanceof Cesium.Cartesian3 &&
              viewer.camera.flyToBoundingSphere(
                new Cesium.BoundingSphere(center),
                options
              ),
            center instanceof Array &&
              ((opt = new Cesium.BoundingSphere(
                Cesium.Cartesian3.fromDegrees(center[0], center[1], center[2])
              )),
              viewer.camera.flyToBoundingSphere(opt, options)))
          : console.log("缺少定位坐标！")
        : console.log("util.flyTo缺少viewer对象");
    },
    getCameraView: function (viewer) {
      var heading, pitch, position;
      if ((viewer = viewer || window.viewer))
        return (
          (position = (viewer = viewer.camera).position),
          (heading = viewer.heading),
          (pitch = viewer.pitch),
          (viewer = viewer.roll),
          (position = Cesium.Cartographic.fromCartesian(position)),
          {
            x: Cesium.Math.toDegrees(position.longitude),
            y: Cesium.Math.toDegrees(position.latitude),
            z: position.height,
            heading: Cesium.Math.toDegrees(heading),
            pitch: Cesium.Math.toDegrees(pitch),
            roll: Cesium.Math.toDegrees(viewer),
          }
        );
      console.log("util.getCameraView缺少viewer对象");
    },
    setCameraView: function (obj, viewer) {
      var position;
      (viewer = viewer || window.viewer)
        ? obj &&
          ((position =
            obj.destination ||
            Cesium.Cartesian3.fromDegrees(obj.x, obj.y, obj.z)),
          viewer.camera.flyTo({
            destination: position,
            orientation: {
              heading: Cesium.Math.toRadians(obj.heading || 0),
              pitch: Cesium.Math.toRadians(obj.pitch || 0),
              roll: Cesium.Math.toRadians(obj.roll || 0),
            },
            duration: void 0 === obj.duration ? 3 : obj.duration,
            complete: obj.complete,
          }))
        : console.log("util.setCameraView缺少viewer对象");
    },
    getViewCenter: function (viewer) {
      var west, north;
      if (viewer)
        return (
          (west =
            ((viewer = viewer.camera.computeViewRectangle()).west / Math.PI) *
            180),
          (north = (viewer.north / Math.PI) * 180),
          [
            ((viewer.east / Math.PI) * 180 + west) / 2,
            (north + (viewer.south / Math.PI) * 180) / 2,
          ]
        );
    },
    oreatationToHpr: function (position, orientation, toDegrees) {
      var matrix3Scratch;
      if (position && orientation)
        return (
          (matrix3Scratch = new Cesium.Matrix3()),
          (orientation = Cesium.Matrix3.fromQuaternion(
            orientation,
            matrix3Scratch
          )),
          (matrix3Scratch = Cesium.Matrix4.fromRotationTranslation(
            orientation,
            position,
            new Cesium.Matrix4()
          )),
          (position = (orientation =
            Cesium.Transforms.fixedFrameToHeadingPitchRoll(
              matrix3Scratch,
              Cesium.Ellipsoid.WGS84,
              Cesium.Transforms.eastNorthUpToFixedFrame,
              new Cesium.HeadingPitchRoll()
            )).heading),
          (matrix3Scratch = orientation.pitch),
          (orientation = orientation.roll),
          toDegrees &&
            ((position = Cesium.Math.toDegrees(position)),
            (matrix3Scratch = Cesium.Math.toDegrees(matrix3Scratch)),
            (orientation = Cesium.Math.toDegrees(orientation))),
          { heading: position, pitch: matrix3Scratch, roll: orientation }
        );
    },
  },
  PI = 3.141592653589793,
  a$1 = 6378245,
  ee = 0.006693421622965943;
function transformWD(lng, lat) {
  var ret =
    2 * lng -
    100 +
    3 * lat +
    0.2 * lat * lat +
    0.1 * lng * lat +
    0.2 * Math.sqrt(Math.abs(lng));
  return (
    (ret +=
      (2 * (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI))) / 3) +
    (2 * (20 * Math.sin(lat * PI) + 40 * Math.sin((lat / 3) * PI))) / 3 +
    (2 * (160 * Math.sin((lat / 12) * PI) + 320 * Math.sin((lat * PI) / 30))) /
      3
  );
}
function transformJD(lng, lat) {
  lat =
    300 +
    lng +
    2 * lat +
    0.1 * lng * lng +
    0.1 * lng * lat +
    0.1 * Math.sqrt(Math.abs(lng));
  return (
    (lat +=
      (2 * (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI))) / 3) +
    (2 * (20 * Math.sin(lng * PI) + 40 * Math.sin((lng / 3) * PI))) / 3 +
    (2 * (150 * Math.sin((lng / 12) * PI) + 300 * Math.sin((lng / 30) * PI))) /
      3
  );
}
(util$1.wgs2gcj = function (arrdata) {
  var lng = Number(arrdata[0]),
    arrdata = Number(arrdata[1]),
    dlat = transformWD(lng - 105, arrdata - 35),
    dlng = transformJD(lng - 105, arrdata - 35),
    radlat = (arrdata / 180) * PI,
    magic = Math.sin(radlat),
    magic = 1 - ee * magic * magic,
    sqrtmagic = Math.sqrt(magic),
    arrdata =
      arrdata + (180 * dlat) / (((a$1 * (1 - ee)) / (magic * sqrtmagic)) * PI),
    dlat = lng + (180 * dlng) / ((a$1 / sqrtmagic) * Math.cos(radlat) * PI);
  return [
    (dlat = Number(dlat.toFixed(6))),
    (arrdata = Number(arrdata.toFixed(6))),
  ];
}),
  (util$1.gcj2wgs = function (arrdata) {
    var lng = Number(arrdata[0]),
      arrdata = Number(arrdata[1]),
      dlat = transformWD(lng - 105, arrdata - 35),
      dlng = transformJD(lng - 105, arrdata - 35),
      radlat = (arrdata / 180) * PI,
      magic = Math.sin(radlat),
      magic = 1 - ee * magic * magic,
      sqrtmagic = Math.sqrt(magic),
      dlat = (180 * dlat) / (((a$1 * (1 - ee)) / (magic * sqrtmagic)) * PI),
      magic =
        2 * lng -
        (lng + (180 * dlng) / ((a$1 / sqrtmagic) * Math.cos(radlat) * PI)),
      lng = 2 * arrdata - (arrdata + dlat);
    return [(magic = Number(magic.toFixed(6))), (lng = Number(lng.toFixed(6)))];
  }),
  (util$1.lerpPositions = function (positions, granularity) {
    if (positions && 0 != positions.length) {
      for (var dis = 0, i = 1; i < positions.length; i++)
        dis += Cesium.Cartesian3.distance(positions[i], positions[i - 1]);
      var surfacePositions = Cesium.PolylinePipeline.generateArc({
        positions: positions,
        granularity: granularity || 1e-9 * dis,
      });
      if (surfacePositions) {
        for (var arr = [], _i = 0; _i < surfacePositions.length; _i += 3) {
          var cartesian = Cesium.Cartesian3.unpack(surfacePositions, _i);
          arr.push(cartesian);
        }
        return arr;
      }
    }
  }),
  (util$1.getIntersectPosition = function (obj, viewer) {
    if (viewer) {
      var p1 = obj.startPoint,
        obj = obj.endPoint;
      if (p1 && obj)
        return (
          (obj = Cesium.Cartesian3.subtract(
            obj.clone(),
            p1.clone(),
            new Cesium.Cartesian3()
          )),
          (obj = Cesium.Cartesian3.normalize(obj, new Cesium.Cartesian3())),
          (p1 = new Cesium.Ray(p1.clone(), obj.clone())),
          (obj = viewer.scene.pickFromRay(p1)) ? obj.position : null
        );
      console.log("缺少坐标！");
    } else console.log("util.getIntersectPosition缺少viewer对象");
  }),
  (util$1.getCirclePointsByAngle = function (center, aimP, angle) {
    var dis = Cesium.Cartesian3.distance(center.clone(), aimP.clone()),
      circlePositions = [];
    angle = angle || 60;
    for (var i = 0; i < 360; i += angle) {
      var hpr = new Cesium.HeadingPitchRoll(
          Cesium.Math.toRadians(i),
          Cesium.Math.toRadians(0),
          Cesium.Math.toRadians(0)
        ),
        hpr = Cesium.Transforms.headingPitchRollToFixedFrame(
          center.clone(),
          hpr
        ),
        hpr = Cesium.Matrix4.getMatrix3(hpr, new Cesium.Matrix3()),
        hpr = Cesium.Matrix3.multiplyByVector(
          hpr,
          aimP.clone(),
          new Cesium.Cartesian3()
        ),
        dir = Cesium.Cartesian3.subtract(
          hpr.clone(),
          center.clone(),
          new Cesium.Cartesian3()
        ),
        dir = Cesium.Cartesian3.normalize(dir, new Cesium.Cartesian3()),
        hpr =
          ((dir = Cesium.Cartesian3.multiplyByScalar(
            dir,
            dis,
            new Cesium.Cartesian3()
          )),
          Cesium.Cartesian3.add(
            center.clone(),
            dir.clone(),
            new Cesium.Cartesian3()
          )),
        dir = Cesium.Cartographic.fromCartesian(hpr.clone());
      circlePositions.push(dir);
    }
    return circlePositions.unshift(), circlePositions;
  }),
  (util$1.getCirclePointsByRadius = function (opt) {
    var opt = opt || {},
      center = opt.center,
      radius = opt.radius,
      angle = opt.angle,
      heading = opt.heading;
    if (center && radius) {
      for (
        var angle = angle || 60,
          heading = heading || 0,
          positions = [],
          mtx4 = Cesium.Transforms.eastNorthUpToFixedFrame(center.clone()),
          opt = Cesium.Matrix4.inverse(mtx4, new Cesium.Matrix4()),
          opt = Cesium.Matrix4.multiplyByPoint(
            opt,
            center.clone(),
            new Cesium.Cartesian3()
          ),
          rposition = Cesium.Cartesian3.add(
            opt,
            new Cesium.Cartesian3(radius, 0, 0),
            new Cesium.Cartesian3()
          ),
          i = 0;
        i <= 360;
        i += angle
      ) {
        var radians = Cesium.Math.toRadians(i + heading),
          radians = Cesium.Matrix3.fromRotationZ(radians),
          radians = Cesium.Matrix3.multiplyByVector(
            radians,
            rposition.clone(),
            new Cesium.Cartesian3()
          ),
          radians = Cesium.Matrix4.multiplyByPoint(
            mtx4,
            radians.clone(),
            new Cesium.Cartesian3()
          );
        positions.push(radians);
      }
      return positions;
    }
  }),
  (util$1.computeAngle = function (p1, p2) {
    var lng_a = p1.longitude,
      p1 = p1.latitude,
      lng_b = p2.longitude,
      p2 = p2.latitude,
      y = Math.sin(lng_b - lng_a) * Math.cos(p2),
      p1 =
        Math.cos(p1) * Math.sin(p2) -
        Math.sin(p1) * Math.cos(p2) * Math.cos(lng_b - lng_a),
      p2 = Math.atan2(y, p1);
    return (p2 = (180 * p2) / Math.PI) < -180 && (p2 += 360), p2;
  }),
  (util$1.updatePositionsHeight = function (pois, h) {
    if (pois && null != h) {
      for (var newPois = [], i = 0; i < pois.length; i++) {
        var c3 = pois[i],
          c3 = util$1.cartesianToLnglat(c3),
          c3 = Cesium.Cartesian3.fromDegrees(c3[0], c3[1], h);
        newPois.push(c3);
      }
      return newPois;
    }
  }),
  (util$1.computeUniforms = function (positions, isOn3dtiles, viewer) {
    if (viewer) {
      var area = util$1.computeArea(positions, viewer) / 1e3;
      if (positions) {
        var positions = new Cesium.PolygonGeometry.fromPositions({
            positions: positions,
            vertexFormat: Cesium.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
            granularity: (Math.PI / Math.pow(2, 11) / 1e3) * (area / 10),
          }),
          geom = new Cesium.PolygonGeometry.createGeometry(positions),
          indices = geom.indices,
          attrPosition = geom.attributes.position,
          data = { uniformArr: [] };
        (data.minHeight = Number.MAX_VALUE),
          (data.maxHeight = Number.MIN_VALUE);
        for (var index = 0; index < indices.length; index += 3) {
          var obj = {},
            first = indices[index],
            second = indices[index + 1],
            third = indices[index + 2],
            first = new Cesium.Cartesian3(
              attrPosition.values[3 * first],
              geom.attributes.position.values[3 * first + 1],
              attrPosition.values[3 * first + 2]
            ),
            h1 = void 0,
            h1 = isOn3dtiles
              ? util$1.get3dtilesHeight(first, viewer)
              : util$1.getTerrainHeight(first, viewer),
            second = new Cesium.Cartesian3(
              attrPosition.values[3 * second],
              geom.attributes.position.values[3 * second + 1],
              attrPosition.values[3 * second + 2]
            ),
            h2 = void 0,
            h2 = isOn3dtiles
              ? util$1.get3dtilesHeight(second, viewer)
              : util$1.getTerrainHeight(second, viewer),
            third = new Cesium.Cartesian3(
              geom.attributes.position.values[3 * third],
              geom.attributes.position.values[3 * third + 1],
              attrPosition.values[3 * third + 2]
            ),
            h3 = void 0,
            h3 = isOn3dtiles
              ? util$1.get3dtilesHeight(third, viewer)
              : util$1.getTerrainHeight(third, viewer);
          (obj.height = (h1 + h2 + h3) / 3),
            data.minHeight > obj.height && (data.minHeight = obj.height),
            data.maxHeight < obj.height && (data.maxHeight = obj.height),
            (obj.area = util$1.computeAreaOfTriangle(first, second, third)),
            data.uniformArr.push(obj);
        }
        return data;
      }
    } else console.log("util.computeUniforms缺少viewer对象");
  }),
  (util$1.computeArea = function (positions, viewer) {
    if (viewer)
      return (
        (positions = positions.concat([positions[0]])),
        (positions = util$1.cartesiansToLnglats(positions, viewer)),
        (viewer = polygon([positions])),
        area(viewer)
      );
    console.log("util.computeArea缺少viewer对象");
  }),
  (util$1.isPointInPolygon = function (point$1, lnglats) {
    (point$1 = point(point$1)),
      (lnglats[0] = lnglats[0].concat([lnglats[0][0]])),
      (lnglats = polygon([lnglats]));
    return booleanPointInPolygon(point$1, lnglats);
  }),
  (util$1.getTerrainHeight = function (position, viewer) {
    if (viewer) {
      if (position && viewer)
        return viewer.scene.globe.getHeight(
          Cesium.Cartographic.fromCartesian(position)
        );
    } else console.log("util.getTerrainHeight缺少viewer对象");
  }),
  (util$1.get3dtilesHeight = function (position, viewer) {
    if (viewer) {
      if (position && viewer)
        return viewer.scene.sampleHeight(
          Cesium.Cartographic.fromCartesian(position)
        );
    } else console.log("util.get3dtilesHeight缺少viewer对象");
  }),
  (util$1.computeAreaOfTriangle = function (pos1, pos2, pos3) {
    var a;
    return pos1 && pos2 && pos3
      ? ((pos1 =
          ((a = Cesium.Cartesian3.distance(pos1, pos2)) +
            (pos2 = Cesium.Cartesian3.distance(pos2, pos3)) +
            (pos3 = Cesium.Cartesian3.distance(pos3, pos1))) /
          2),
        Math.sqrt(pos1 * (pos1 - a) * (pos1 - pos2) * (pos1 - pos3)))
      : (console.log("传入坐标有误！"), 0);
  }),
  (util$1.getSlopePosition = function (center, radius, angle, viewer) {
    if (viewer) {
      if (viewer && center) {
        var positions = util$1.getCirclePointsByRadius(
            { center: center, radius: radius || 10, angle: angle || 10 },
            viewer
          ),
          minH = Number.MAX_VALUE,
          radius = util$1.getTerrainHeight(center.clone(), viewer);
        if (radius) {
          for (var step = -1, i = 0; i < positions.length; i++) {
            var h = util$1.getTerrainHeight(positions[i], viewer);
            h < minH && ((minH = h), (step = i));
          }
          var angle = (
              minH < radius
                ? ((startP = center.clone()), positions[step])
                : ((startP = positions[step].clone()), center)
            ).clone(),
            center = Cesium.Cartographic.fromCartesian(startP),
            endCgtc = Cesium.Cartographic.fromCartesian(angle),
            startP = Cesium.Cartesian3.fromRadians(
              center.longitude,
              center.latitude,
              minH < radius ? radius : minH
            ),
            center =
              ((angle = Cesium.Cartesian3.fromRadians(
                endCgtc.longitude,
                endCgtc.latitude,
                minH < radius ? minH : radius
              )),
              Cesium.Cartesian3.distance(startP, angle)),
            endCgtc = Math.abs(radius - minH),
            radius = Math.acos(endCgtc / center);
          return {
            startP: startP,
            endP: angle,
            slope: Cesium.Math.toDegrees(radius),
          };
        }
      }
    } else console.log("util.getSlopePosition缺少viewer对象");
  }),
  (util$1.control = { isOpenRightTool: !0 });
var tool = {};
function _download(fileName, blob) {
  var aLink = document.createElement("a");
  (aLink.download = fileName),
    (aLink.href = URL.createObjectURL(blob)),
    document.body.appendChild(aLink),
    aLink.click(),
    document.body.removeChild(aLink);
}
function base64Img2Blob(code) {
  for (
    var code = code.split(";base64,"),
      contentType = code[0].split(":")[1],
      raw = window.atob(code[1]),
      rawLength = raw.length,
      uInt8Array = new Uint8Array(rawLength),
      i = 0;
    i < rawLength;
    ++i
  )
    uInt8Array[i] = raw.charCodeAt(i);
  return new Blob([uInt8Array], { type: contentType });
}
function _regeneratorRuntime() {
  _regeneratorRuntime = function () {
    return exports;
  };
  var exports = {},
    Op = Object.prototype,
    hasOwn = Op.hasOwnProperty,
    $Symbol = "function" == typeof Symbol ? Symbol : {},
    iteratorSymbol = $Symbol.iterator || "@@iterator",
    asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
    toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  function define(obj, key, value) {
    return (
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: !0,
        configurable: !0,
        writable: !0,
      }),
      obj[key]
    );
  }
  try {
    define({}, "");
  } catch (err) {
    define = function (obj, key, value) {
      return (obj[key] = value);
    };
  }
  function wrap(innerFn, outerFn, self, tryLocsList) {
    (outerFn =
      outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator),
      (outerFn = Object.create(outerFn.prototype)),
      (tryLocsList = new Context(tryLocsList || []));
    return (
      (outerFn._invoke = (function (innerFn, self, context) {
        var state = "suspendedStart";
        return function (method, arg) {
          if ("executing" === state)
            throw new Error("Generator is already running");
          if ("completed" === state) {
            if ("throw" === method) throw arg;
            return doneResult();
          }
          for (context.method = method, context.arg = arg; ; ) {
            var delegate = context.delegate;
            if (delegate) {
              delegate = (function maybeInvokeDelegate(delegate, context) {
                var method = delegate.iterator[context.method];
                if (void 0 === method) {
                  if (((context.delegate = null), "throw" === context.method)) {
                    if (
                      delegate.iterator.return &&
                      ((context.method = "return"),
                      (context.arg = void 0),
                      maybeInvokeDelegate(delegate, context),
                      "throw" === context.method)
                    )
                      return ContinueSentinel;
                    (context.method = "throw"),
                      (context.arg = new TypeError(
                        "The iterator does not provide a 'throw' method"
                      ));
                  }
                  return ContinueSentinel;
                }
                method = tryCatch(method, delegate.iterator, context.arg);
                if ("throw" === method.type)
                  return (
                    (context.method = "throw"),
                    (context.arg = method.arg),
                    (context.delegate = null),
                    ContinueSentinel
                  );
                method = method.arg;
                return method
                  ? method.done
                    ? ((context[delegate.resultName] = method.value),
                      (context.next = delegate.nextLoc),
                      "return" !== context.method &&
                        ((context.method = "next"), (context.arg = void 0)),
                      (context.delegate = null),
                      ContinueSentinel)
                    : method
                  : ((context.method = "throw"),
                    (context.arg = new TypeError(
                      "iterator result is not an object"
                    )),
                    (context.delegate = null),
                    ContinueSentinel);
              })(delegate, context);
              if (delegate) {
                if (delegate === ContinueSentinel) continue;
                return delegate;
              }
            }
            if ("next" === context.method)
              context.sent = context._sent = context.arg;
            else if ("throw" === context.method) {
              if ("suspendedStart" === state)
                throw ((state = "completed"), context.arg);
              context.dispatchException(context.arg);
            } else
              "return" === context.method &&
                context.abrupt("return", context.arg);
            state = "executing";
            delegate = tryCatch(innerFn, self, context);
            if ("normal" === delegate.type) {
              if (
                ((state = context.done ? "completed" : "suspendedYield"),
                delegate.arg === ContinueSentinel)
              )
                continue;
              return { value: delegate.arg, done: context.done };
            }
            "throw" === delegate.type &&
              ((state = "completed"),
              (context.method = "throw"),
              (context.arg = delegate.arg));
          }
        };
      })(innerFn, self, tryLocsList)),
      outerFn
    );
  }
  function tryCatch(fn, obj, arg) {
    try {
      return { type: "normal", arg: fn.call(obj, arg) };
    } catch (err) {
      return { type: "throw", arg: err };
    }
  }
  exports.wrap = wrap;
  var ContinueSentinel = {};
  function Generator() {}
  function GeneratorFunction() {}
  function GeneratorFunctionPrototype() {}
  var $Symbol = {},
    getProto =
      (define($Symbol, iteratorSymbol, function () {
        return this;
      }),
      Object.getPrototypeOf),
    getProto = getProto && getProto(getProto(values([]))),
    Gp =
      (getProto &&
        getProto !== Op &&
        hasOwn.call(getProto, iteratorSymbol) &&
        ($Symbol = getProto),
      (GeneratorFunctionPrototype.prototype = Generator.prototype =
        Object.create($Symbol)));
  function defineIteratorMethods(prototype) {
    ["next", "throw", "return"].forEach(function (method) {
      define(prototype, method, function (arg) {
        return this._invoke(method, arg);
      });
    });
  }
  function AsyncIterator(generator, PromiseImpl) {
    var previousPromise;
    this._invoke = function (method, arg) {
      function callInvokeWithMethodAndArg() {
        return new PromiseImpl(function (resolve, reject) {
          !(function invoke(method, arg, resolve, reject) {
            var result,
              method = tryCatch(generator[method], generator, arg);
            if ("throw" !== method.type)
              return (arg = (result = method.arg).value) &&
                "object" == typeof arg &&
                hasOwn.call(arg, "__await")
                ? PromiseImpl.resolve(arg.__await).then(
                    function (value) {
                      invoke("next", value, resolve, reject);
                    },
                    function (err) {
                      invoke("throw", err, resolve, reject);
                    }
                  )
                : PromiseImpl.resolve(arg).then(
                    function (unwrapped) {
                      (result.value = unwrapped), resolve(result);
                    },
                    function (error) {
                      return invoke("throw", error, resolve, reject);
                    }
                  );
            reject(method.arg);
          })(method, arg, resolve, reject);
        });
      }
      return (previousPromise = previousPromise
        ? previousPromise.then(
            callInvokeWithMethodAndArg,
            callInvokeWithMethodAndArg
          )
        : callInvokeWithMethodAndArg());
    };
  }
  function pushTryEntry(locs) {
    var entry = { tryLoc: locs[0] };
    1 in locs && (entry.catchLoc = locs[1]),
      2 in locs && ((entry.finallyLoc = locs[2]), (entry.afterLoc = locs[3])),
      this.tryEntries.push(entry);
  }
  function resetTryEntry(entry) {
    var record = entry.completion || {};
    (record.type = "normal"), delete record.arg, (entry.completion = record);
  }
  function Context(tryLocsList) {
    (this.tryEntries = [{ tryLoc: "root" }]),
      tryLocsList.forEach(pushTryEntry, this),
      this.reset(!0);
  }
  function values(iterable) {
    if (iterable) {
      var i,
        iteratorMethod = iterable[iteratorSymbol];
      if (iteratorMethod) return iteratorMethod.call(iterable);
      if ("function" == typeof iterable.next) return iterable;
      if (!isNaN(iterable.length))
        return (
          (i = -1),
          ((iteratorMethod = function next() {
            for (; ++i < iterable.length; )
              if (hasOwn.call(iterable, i))
                return (next.value = iterable[i]), (next.done = !1), next;
            return (next.value = void 0), (next.done = !0), next;
          }).next = iteratorMethod)
        );
    }
    return { next: doneResult };
  }
  function doneResult() {
    return { value: void 0, done: !0 };
  }
  return (
    define(
      Gp,
      "constructor",
      (GeneratorFunction.prototype = GeneratorFunctionPrototype)
    ),
    define(GeneratorFunctionPrototype, "constructor", GeneratorFunction),
    (GeneratorFunction.displayName = define(
      GeneratorFunctionPrototype,
      toStringTagSymbol,
      "GeneratorFunction"
    )),
    (exports.isGeneratorFunction = function (genFun) {
      genFun = "function" == typeof genFun && genFun.constructor;
      return (
        !!genFun &&
        (genFun === GeneratorFunction ||
          "GeneratorFunction" === (genFun.displayName || genFun.name))
      );
    }),
    (exports.mark = function (genFun) {
      return (
        Object.setPrototypeOf
          ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype)
          : ((genFun.__proto__ = GeneratorFunctionPrototype),
            define(genFun, toStringTagSymbol, "GeneratorFunction")),
        (genFun.prototype = Object.create(Gp)),
        genFun
      );
    }),
    (exports.awrap = function (arg) {
      return { __await: arg };
    }),
    defineIteratorMethods(AsyncIterator.prototype),
    define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
      return this;
    }),
    (exports.AsyncIterator = AsyncIterator),
    (exports.async = function (
      innerFn,
      outerFn,
      self,
      tryLocsList,
      PromiseImpl
    ) {
      void 0 === PromiseImpl && (PromiseImpl = Promise);
      var iter = new AsyncIterator(
        wrap(innerFn, outerFn, self, tryLocsList),
        PromiseImpl
      );
      return exports.isGeneratorFunction(outerFn)
        ? iter
        : iter.next().then(function (result) {
            return result.done ? result.value : iter.next();
          });
    }),
    defineIteratorMethods(Gp),
    define(Gp, toStringTagSymbol, "Generator"),
    define(Gp, iteratorSymbol, function () {
      return this;
    }),
    define(Gp, "toString", function () {
      return "[object Generator]";
    }),
    (exports.keys = function (object) {
      var key,
        keys = [];
      for (key in object) keys.push(key);
      return (
        keys.reverse(),
        function next() {
          for (; keys.length; ) {
            var key = keys.pop();
            if (key in object)
              return (next.value = key), (next.done = !1), next;
          }
          return (next.done = !0), next;
        }
      );
    }),
    (exports.values = values),
    (Context.prototype = {
      constructor: Context,
      reset: function (skipTempReset) {
        if (
          ((this.prev = 0),
          (this.next = 0),
          (this.sent = this._sent = void 0),
          (this.done = !1),
          (this.delegate = null),
          (this.method = "next"),
          (this.arg = void 0),
          this.tryEntries.forEach(resetTryEntry),
          !skipTempReset)
        )
          for (var name in this)
            "t" === name.charAt(0) &&
              hasOwn.call(this, name) &&
              !isNaN(+name.slice(1)) &&
              (this[name] = void 0);
      },
      stop: function () {
        this.done = !0;
        var rootRecord = this.tryEntries[0].completion;
        if ("throw" === rootRecord.type) throw rootRecord.arg;
        return this.rval;
      },
      dispatchException: function (exception) {
        if (this.done) throw exception;
        var context = this;
        function handle(loc, caught) {
          return (
            (record.type = "throw"),
            (record.arg = exception),
            (context.next = loc),
            caught && ((context.method = "next"), (context.arg = void 0)),
            !!caught
          );
        }
        for (var i = this.tryEntries.length - 1; 0 <= i; --i) {
          var entry = this.tryEntries[i],
            record = entry.completion;
          if ("root" === entry.tryLoc) return handle("end");
          if (entry.tryLoc <= this.prev) {
            var hasCatch = hasOwn.call(entry, "catchLoc"),
              hasFinally = hasOwn.call(entry, "finallyLoc");
            if (hasCatch && hasFinally) {
              if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
              if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
            } else if (hasCatch) {
              if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
            } else {
              if (!hasFinally)
                throw new Error("try statement without catch or finally");
              if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
            }
          }
        }
      },
      abrupt: function (type, arg) {
        for (var i = this.tryEntries.length - 1; 0 <= i; --i) {
          var entry = this.tryEntries[i];
          if (
            entry.tryLoc <= this.prev &&
            hasOwn.call(entry, "finallyLoc") &&
            this.prev < entry.finallyLoc
          ) {
            var finallyEntry = entry;
            break;
          }
        }
        var record = (finallyEntry =
          finallyEntry &&
          ("break" === type || "continue" === type) &&
          finallyEntry.tryLoc <= arg &&
          arg <= finallyEntry.finallyLoc
            ? null
            : finallyEntry)
          ? finallyEntry.completion
          : {};
        return (
          (record.type = type),
          (record.arg = arg),
          finallyEntry
            ? ((this.method = "next"),
              (this.next = finallyEntry.finallyLoc),
              ContinueSentinel)
            : this.complete(record)
        );
      },
      complete: function (record, afterLoc) {
        if ("throw" === record.type) throw record.arg;
        return (
          "break" === record.type || "continue" === record.type
            ? (this.next = record.arg)
            : "return" === record.type
            ? ((this.rval = this.arg = record.arg),
              (this.method = "return"),
              (this.next = "end"))
            : "normal" === record.type && afterLoc && (this.next = afterLoc),
          ContinueSentinel
        );
      },
      finish: function (finallyLoc) {
        for (var i = this.tryEntries.length - 1; 0 <= i; --i) {
          var entry = this.tryEntries[i];
          if (entry.finallyLoc === finallyLoc)
            return (
              this.complete(entry.completion, entry.afterLoc),
              resetTryEntry(entry),
              ContinueSentinel
            );
        }
      },
      catch: function (tryLoc) {
        for (var i = this.tryEntries.length - 1; 0 <= i; --i) {
          var record,
            thrown,
            entry = this.tryEntries[i];
          if (entry.tryLoc === tryLoc)
            return (
              "throw" === (record = entry.completion).type &&
                ((thrown = record.arg), resetTryEntry(entry)),
              thrown
            );
        }
        throw new Error("illegal catch attempt");
      },
      delegateYield: function (iterable, resultName, nextLoc) {
        return (
          (this.delegate = {
            iterator: values(iterable),
            resultName: resultName,
            nextLoc: nextLoc,
          }),
          "next" === this.method && (this.arg = void 0),
          ContinueSentinel
        );
      },
    }),
    exports
  );
}
function _typeof(obj) {
  return (_typeof =
    "function" == typeof Symbol && "symbol" == typeof Symbol.iterator
      ? function (obj) {
          return typeof obj;
        }
      : function (obj) {
          return obj &&
            "function" == typeof Symbol &&
            obj.constructor === Symbol &&
            obj !== Symbol.prototype
            ? "symbol"
            : typeof obj;
        })(obj);
}
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  try {
    var info = gen[key](arg),
      value = info.value;
  } catch (error) {
    return void reject(error);
  }
  info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
}
function _asyncToGenerator(fn) {
  return function () {
    var self = this,
      args = arguments;
    return new Promise(function (resolve, reject) {
      var gen = fn.apply(self, args);
      function _next(value) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
      }
      function _throw(err) {
        asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
      }
      _next(void 0);
    });
  };
}
function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor))
    throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(target, props) {
  for (var i = 0; i < props.length; i++) {
    var descriptor = props[i];
    (descriptor.enumerable = descriptor.enumerable || !1),
      (descriptor.configurable = !0),
      "value" in descriptor && (descriptor.writable = !0),
      Object.defineProperty(target, descriptor.key, descriptor);
  }
}
function _createClass(Constructor, protoProps, staticProps) {
  return (
    protoProps && _defineProperties(Constructor.prototype, protoProps),
    staticProps && _defineProperties(Constructor, staticProps),
    Object.defineProperty(Constructor, "prototype", { writable: !1 }),
    Constructor
  );
}
function _defineProperty(obj, key, value) {
  return (
    key in obj
      ? Object.defineProperty(obj, key, {
          value: value,
          enumerable: !0,
          configurable: !0,
          writable: !0,
        })
      : (obj[key] = value),
    obj
  );
}
function _inherits(subClass, superClass) {
  if ("function" != typeof superClass && null !== superClass)
    throw new TypeError("Super expression must either be null or a function");
  (subClass.prototype = Object.create(superClass && superClass.prototype, {
    constructor: { value: subClass, writable: !0, configurable: !0 },
  })),
    Object.defineProperty(subClass, "prototype", { writable: !1 }),
    superClass && _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
  return (_getPrototypeOf = Object.setPrototypeOf
    ? Object.getPrototypeOf.bind()
    : function (o) {
        return o.__proto__ || Object.getPrototypeOf(o);
      })(o);
}
function _setPrototypeOf(o, p) {
  return (_setPrototypeOf = Object.setPrototypeOf
    ? Object.setPrototypeOf.bind()
    : function (o, p) {
        return (o.__proto__ = p), o;
      })(o, p);
}
function _isNativeReflectConstruct() {
  if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  if (Reflect.construct.sham) return !1;
  if ("function" == typeof Proxy) return !0;
  try {
    return (
      Boolean.prototype.valueOf.call(
        Reflect.construct(Boolean, [], function () {})
      ),
      !0
    );
  } catch (e) {
    return !1;
  }
}
function _assertThisInitialized(self) {
  if (void 0 === self)
    throw new ReferenceError(
      "this hasn't been initialised - super() hasn't been called"
    );
  return self;
}
function _possibleConstructorReturn(self, call) {
  if (call && ("object" == typeof call || "function" == typeof call))
    return call;
  if (void 0 !== call)
    throw new TypeError(
      "Derived constructors may only return object or undefined"
    );
  return _assertThisInitialized(self);
}
function _createSuper(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
  return function () {
    var NewTarget,
      Super = _getPrototypeOf(Derived);
    return _possibleConstructorReturn(
      this,
      hasNativeReflectConstruct
        ? ((NewTarget = _getPrototypeOf(this).constructor),
          Reflect.construct(Super, arguments, NewTarget))
        : Super.apply(this, arguments)
    );
  };
}
function _superPropBase(object, property) {
  for (
    ;
    !Object.prototype.hasOwnProperty.call(object, property) &&
    null !== (object = _getPrototypeOf(object));

  );
  return object;
}
function _get() {
  return (_get =
    "undefined" != typeof Reflect && Reflect.get
      ? Reflect.get.bind()
      : function (target, property, receiver) {
          var base = _superPropBase(target, property);
          if (base)
            return (base = Object.getOwnPropertyDescriptor(base, property)).get
              ? base.get.call(arguments.length < 3 ? target : receiver)
              : base.value;
        }).apply(this, arguments);
}
(tool.downloadFile = function (fileName, datastr) {
  _download(fileName, new Blob([datastr]));
}),
  (tool.downloadImage = function (fileName, canvas) {
    _download(fileName + ".png", base64Img2Blob(canvas.toDataURL("image/png")));
  }),
  (tool.tree2line = function (data, fieldName) {
    var arr;
    return (
      (fieldName = fieldName || "children"),
      data
        ? ((arr = []),
          (function recurse(item) {
            var itemCopy = JSON.parse(JSON.stringify(item));
            if (
              (delete itemCopy[fieldName],
              item[fieldName] && 0 < item[fieldName].length)
            )
              for (var i = 0; i < item[fieldName].length; i++) {
                var one = item[fieldName][i];
                (one.parentAttr = itemCopy), recurse(one);
              }
            else arr.push(itemCopy);
          })(data),
          arr)
        : []
    );
  });
var Prompt$1 = (function () {
    function Prompt(viewer, opt) {
      var defaultOpt,
        closeHtml,
        boxShadow,
        promptId,
        background,
        color,
        that,
        _this = this;
      _classCallCheck(this, Prompt),
        (this.viewer = viewer),
        this.viewer &&
          ((this.type = "prompt"),
          (viewer = null == (opt = opt || {}).type ? 1 : opt.type),
          (defaultOpt = {
            id: new Date().getTime() + "" + Math.floor(1e4 * Math.random()),
            type: viewer,
            anchor: 2 == viewer,
            closeBtn: 2 == viewer,
            offset: 2 == viewer ? { x: 0, y: -20 } : { x: 10, y: 10 },
            content: "",
            show: !0,
            style: { background: "rgba(0,0,0,0.5)", color: "white" },
            client: !1,
          }),
          (this.opt = Object.assign(defaultOpt, opt)),
          (this.attr = this.opt),
          (defaultOpt = this.viewer.container.id),
          (this.isShow = null == this.opt.show || this.opt.show),
          (closeHtml = opt = ""),
          (background = this.opt.style.background),
          (color = this.opt.style.color),
          this.opt.anchor &&
            (opt +=
              '\n            <div class="prompt-anchor-container">\n                <div class="prompt-anchor" style="background:'.concat(
                background,
                ' !important;">\n                </div>\n            </div>\n            '
              )),
          this.opt.closeBtn &&
            (closeHtml = '<a class="prompt-close" attr="'
              .concat(this.opt.id, '" id="prompt-close-')
              .concat(this.opt.id, '">x</a>')),
          (boxShadow = this.opt.style.boxShadow),
          (promptId = "prompt-" + this.opt.id),
          (background =
            '\n                \x3c!-- 文本内容 --\x3e\n                <div class="prompt-content-container" style="background:'
              .concat(background, " !important;color:")
              .concat(color, " !important;box-shadow:")
              .concat(
                boxShadow,
                ' !important">\n                    <div class="prompt-content" id="prompt-content-'
              )
              .concat(this.opt.id, '">\n                        ')
              .concat(
                this.opt.content,
                "\n                    </div>\n                </div>\n                \x3c!-- 锚 --\x3e\n                "
              )
              .concat(
                opt,
                "\n                \x3c!-- 关闭按钮 --\x3e\n                "
              )
              .concat(closeHtml, "\n        ")),
          (this.promptDiv = window.document.createElement("div")),
          (this.promptDiv.className = "vis3d-prompt ".concat(
            this.opt.className
          )),
          (this.promptDiv.id = promptId),
          (this.promptDiv.innerHTML = background),
          window.document
            .getElementById(defaultOpt)
            .appendChild(this.promptDiv),
          (color = window.document.getElementById(
            "prompt-close-".concat(this.opt.id)
          )),
          (that = this),
          color &&
            color.addEventListener("click", function (e) {
              that.hide(), that.opt.close && that.opt.close();
            }),
          this.opt.click &&
            window.document
              .getElementById("prompt-content-".concat(this.opt.id))
              .addEventListener("click", function (e) {
                that.opt.click(_this.opt);
              }),
          (this.promptDom = window.document.getElementById(promptId)),
          (this.position = this.transPosition(this.opt.position)),
          2 == viewer && this.bindRender(),
          0 == this.opt.show && this.hide(),
          (this.containerW = this.viewer.container.offsetWidth),
          (this.containerH = this.viewer.container.offsetHeight),
          (this.containerLeft = this.viewer.container.offsetLeft),
          (this.containerTop = this.viewer.container.offsetTop),
          (this.contentW = Math.ceil(Number(this.promptDom.offsetWidth))),
          (this.contentH = this.promptDom.offsetHeight),
          this.opt.success && this.opt.success());
    }
    return (
      _createClass(Prompt, [
        {
          key: "destroy",
          value: function () {
            this.promptDiv &&
              (window.document
                .getElementById(this.viewer.container.id)
                .removeChild(this.promptDiv),
              (this.promptDiv = null)),
              this.rendHandler &&
                (this.rendHandler(), (this.rendHandler = null));
          },
        },
        {
          key: "bindRender",
          value: function () {
            var that = this;
            this.rendHandler = this.viewer.scene.postRender.addEventListener(
              function () {
                var px;
                !that.isShow && that.promptDom
                  ? (that.promptDom.style.display = "none")
                  : that.position &&
                    (that.position instanceof Cesium.Cartesian3
                      ? (px = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
                          that.viewer.scene,
                          that.position
                        )) &&
                        (new Cesium.EllipsoidalOccluder(
                          that.viewer.scene.globe.ellipsoid,
                          that.viewer.scene.camera.position
                        ).isPointVisible(that.position)
                          ? that.promptDom &&
                            (that.promptDom.style.display = "block")
                          : that.promptDom &&
                            (that.promptDom.style.display = "none"),
                        that.setByPX({ x: px.x, y: px.y }))
                      : that.setByPX({
                          x: that.position.x,
                          y: that.position.y,
                        }));
              },
              this
            );
          },
        },
        {
          key: "update",
          value: function (position, html) {
            var px = void 0,
              px =
                (this.position = position) instanceof Cesium.Cartesian3
                  ? Cesium.SceneTransforms.wgs84ToWindowCoordinates(
                      this.viewer.scene,
                      position.clone()
                    )
                  : position;
            (this.contentW = Math.ceil(Number(this.promptDom.offsetWidth))),
              (this.contentH = this.promptDom.offsetHeight),
              html && this.setContent(html),
              px && this.setByPX(px);
          },
        },
        {
          key: "isInView",
          value: function () {
            var px, isface, isin;
            return (
              !!this.position &&
              ((isface = !(px = null)),
              this.position instanceof Cesium.Cartesian2
                ? (px = this.position)
                : ((px = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
                    this.viewer.scene,
                    this.position
                  )),
                  (isface = new Cesium.EllipsoidalOccluder(
                    this.viewer.scene.globe.ellipsoid,
                    this.viewer.scene.camera.position
                  ).isPointVisible(this.position))),
              (isin = !1),
              px.x > this.containerLeft &&
                px.x < this.containerLeft + this.containerW &&
                px.y > this.containerTop &&
                px.y < this.containerTop + this.containerH &&
                (isin = !0),
              isface && isin)
            );
          },
        },
        {
          key: "setVisible",
          value: function (isShow) {
            this.isInView(this.position) && isShow
              ? ((this.isShow = !0),
                this.promptDom && (this.promptDom.style.display = "block"))
              : ((this.isShow = !1),
                this.promptDom && (this.promptDom.style.display = "none"));
          },
        },
        {
          key: "show",
          value: function () {
            this.setVisible(!0);
          },
        },
        {
          key: "hide",
          value: function () {
            this.setVisible(!1);
          },
        },
        {
          key: "setContent",
          value: function (content) {
            window.document.getElementById(
              "prompt-content-".concat(this.opt.id)
            ).innerHTML = content;
          },
        },
        {
          key: "setByPX",
          value: function (opt) {
            opt &&
              this.promptDom &&
              (this.promptDom.offsetWidth,
              this.promptDom.offsetHeight,
              1 == this.opt.type
                ? ((this.promptDom.style.left =
                    Number(opt.x) + Number(this.opt.offset.x || 0) + "px"),
                  (this.promptDom.style.top =
                    Number(opt.y) + Number(this.opt.offset.y || 0) + "px"))
                : ((this.promptDom.style.left =
                    Number(opt.x) +
                    Number(this.opt.offset.x || 0) -
                    Number(this.contentW) / 2 +
                    "px"),
                  (this.promptDom.style.top =
                    Number(opt.y) +
                    Number(this.opt.offset.y || 0) -
                    Number(this.contentH) +
                    "px")));
          },
        },
        {
          key: "transPosition",
          value: function (p) {
            return Array.isArray(p)
              ? Cesium.Cartesian3.fromDegrees(p[0], p[1], p[2] || 0).clone()
              : p instanceof Cesium.Cartesian3
              ? p.clone()
              : p;
          },
        },
      ]),
      Prompt
    );
  })(),
  BasePlot = (function () {
    function BasePlot(viewer, opt) {
      _classCallCheck(this, BasePlot),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.style = this.opt.style || {}),
        (this.objId = Number(
          new Date().getTime() + "" + Number(1e3 * Math.random()).toFixed(0)
        )),
        (this.handler = void 0),
        (this.modifyHandler = void 0),
        (this.type = ""),
        (this.positions = []),
        (this.state = void 0),
        (this.prompt = void 0),
        (this.controlPoints = []),
        (this.modifyPoint = void 0),
        (this.entity = void 0),
        (this.pointStyle = {}),
        (this.promptStyle = this.opt.prompt || { show: !0 }),
        (this.properties = {}),
        (this.scale = this.opt.scale || [1, 1]);
    }
    return (
      _createClass(BasePlot, [
        {
          key: "setRightToolState",
          value: function (isopen) {
            util$1.control.isOpenRightTool = null == isopen || isopen;
          },
        },
        {
          key: "getCatesian3FromPX",
          value: function (px) {
            if (px) {
              (px.x = px.x / this.scale[0]), (px.y = px.y / this.scale[1]);
              for (
                var cartesian,
                  picks = this.viewer.scene.drillPick(px),
                  isOn3dtiles = (this.viewer.scene.render(), !1),
                  i = 0;
                i < picks.length;
                i++
              )
                if (
                  picks[i] &&
                  picks[i].primitive &&
                  picks[i].primitive instanceof Cesium.Cesium3DTileset
                ) {
                  isOn3dtiles = !0;
                  break;
                }
              if (isOn3dtiles) cartesian = this.viewer.scene.pickPosition(px);
              else {
                px = this.viewer.camera.getPickRay(px);
                if (!px) return null;
                cartesian = this.viewer.scene.globe.pick(px, this.viewer.scene);
              }
              return cartesian;
            }
          },
        },
        {
          key: "getEntity",
          value: function () {
            return this.entity;
          },
        },
        {
          key: "getPositions",
          value: function (isWgs84) {
            return isWgs84
              ? util$1.cartesiansToLnglats(this.positions, this.viewer)
              : this.positions;
          },
        },
        {
          key: "getLnglats",
          value: function () {
            return util$1.cartesiansToLnglats(this.positions, this.viewer);
          },
        },
        {
          key: "setOwnProp",
          value: function (prop) {
            this.entity && (this.entity.ownProp = prop);
          },
        },
        {
          key: "remove",
          value: function () {
            this.entity &&
              ((this.state = "no"),
              this.viewer.entities.remove(this.entity),
              (this.entity = void 0));
          },
        },
        {
          key: "setVisible",
          value: function (visible) {
            this.entity && (this.entity.show = visible);
          },
        },
        {
          key: "forbidDrawWorld",
          value: function (isForbid) {
            (this.viewer.scene.screenSpaceCameraController.enableRotate =
              !isForbid),
              (this.viewer.scene.screenSpaceCameraController.enableTilt =
                !isForbid),
              (this.viewer.scene.screenSpaceCameraController.enableTranslate =
                !isForbid),
              (this.viewer.scene.screenSpaceCameraController.enableInputs =
                !isForbid);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              this.entity &&
                (this.viewer.entities.remove(this.entity),
                (this.entity = void 0)),
              (this.positions = []),
              (this.style = void 0);
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              this.viewer.entities.remove(point);
            }
            (this.controlPoints = []),
              (this.modifyPoint = void 0),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "no"),
              this.forbidDrawWorld(!1);
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            if (
              "startEdit" != this.state &&
              "editing" != this.state &&
              this.entity
            ) {
              (this.state = "startEdit"),
                this.modifyHandler ||
                  (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                    this.viewer.scene.canvas
                  ));
              for (var that = this, i = 0; i < that.controlPoints.length; i++) {
                var point = that.controlPoints[i];
                point && (point.show = !0);
              }
              (this.entity.show = !0),
                this.modifyHandler.setInputAction(function (evt) {
                  that.entity &&
                    ((evt = that.viewer.scene.pick(evt.position)),
                    Cesium.defined(evt) &&
                      evt.id &&
                      null != evt.id.wz &&
                      (evt.id.objId || (that.modifyPoint = evt.id),
                      that.forbidDrawWorld(!0)));
                }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
                this.modifyHandler.setInputAction(function (evt) {
                  that.positions.length < 1 ||
                    !that.modifyPoint ||
                    ((evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer,
                      [that.entity, that.modifyPoint]
                    )) &&
                      (that.modifyPoint.position.setValue(evt),
                      (that.positions[that.modifyPoint.wz] = evt),
                      (that.state = "editing"),
                      callback && callback()));
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
                this.modifyHandler.setInputAction(function (evt) {
                  that.modifyPoint &&
                    ((that.modifyPoint = void 0),
                    that.forbidDrawWorld(!1),
                    (that.state = "editing"));
                }, Cesium.ScreenSpaceEventType.LEFT_UP);
            }
          },
        },
        {
          key: "endEdit",
          value: function (callback) {
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              point && (point.show = !1);
            }
            this.modifyHandler &&
              (this.modifyHandler.destroy(),
              (this.modifyHandler = void 0),
              callback && callback(this.entity)),
              this.forbidDrawWorld(!1),
              (this.state = "endEdit");
          },
        },
        { key: "endCreate", value: function () {} },
        { key: "done", value: function () {} },
        {
          key: "createPoint",
          value: function (position) {
            var color, outlineColor;
            if (position)
              return (
                (this.pointStyle.color =
                  this.pointStyle.color || Cesium.Color.CORNFLOWERBLUE),
                (this.pointStyle.outlineColor =
                  this.pointStyle.color || Cesium.Color.CORNFLOWERBLUE),
                (color = (color =
                  this.pointStyle.color instanceof Cesium.Color
                    ? this.pointStyle.color
                    : Cesium.Color.fromCssColorString(
                        this.pointStyle.color
                      )).withAlpha(this.pointStyle.colorAlpha || 1)),
                (outlineColor = (outlineColor =
                  this.pointStyle.outlineColor instanceof Cesium.Color
                    ? this.pointStyle.outlineColor
                    : Cesium.Color.fromCssColorString(
                        this.pointStyle.outlineColor
                      )).withAlpha(this.pointStyle.outlineColorAlpha || 1)),
                this.viewer.entities.add({
                  position: position,
                  point: {
                    pixelSize: this.pointStyle.property || 10,
                    color: color,
                    outlineWidth: this.pointStyle.outlineWidth || 0,
                    outlineColor: outlineColor,
                    disableDepthTestDistance: Number.POSITIVE_INFINITY,
                  },
                  show: !1,
                })
              );
          },
        },
        {
          key: "transfromLineMaterial",
          value: function (material) {
            var colorObj;
            if (material)
              return (
                (colorObj = {}),
                material instanceof Cesium.Color &&
                  ((material = material.color.getValue()),
                  (colorObj.colorAlpha = material.alpha),
                  (colorObj.colorHex = new Cesium.Color(
                    material.red,
                    material.green,
                    material.blue,
                    1
                  ).toCssHexString())),
                colorObj
              );
          },
        },
        {
          key: "transfromGonMaterial",
          value: function (material) {
            var colorObj;
            if (material)
              return (
                (colorObj = {}),
                material instanceof Cesium.Color &&
                  ((material = material.color.getValue()),
                  (colorObj.colorAlpha = material.alpha),
                  (colorObj.colorHex = new Cesium.Color(
                    material.red,
                    material.green,
                    material.blue,
                    1
                  ).toCssHexString())),
                colorObj
              );
          },
        },
        {
          key: "setAttr",
          value: function (attr) {
            this.properties.attr = attr || {};
          },
        },
        {
          key: "getAttr",
          value: function () {
            return this.properties.attr;
          },
        },
        {
          key: "zoomTo",
          value: function () {
            this.entity && this.viewer.zoomTo(this.entity);
          },
        },
      ]),
      BasePlot
    );
  })(),
  CreateBillboard = (function () {
    _inherits(CreateBillboard, BasePlot);
    var _super = _createSuper(CreateBillboard);
    function CreateBillboard(viewer, opt) {
      _classCallCheck(this, CreateBillboard),
        ((_this = _super.call(this, viewer, opt)).opt = opt || {}),
        (_this.style = _this.opt.style),
        (_this.type = "billboard"),
        (_this.viewer = viewer);
      var _this,
        opt = { verticalOrigin: Cesium.VerticalOrigin.BOTTOM, scale: 1 };
      return (
        (_this.style = Object.assign({}, opt, _this.style || {})),
        (_this.entity = void 0),
        _this.style.hasOwnProperty("image") ||
          console.log("未设置billboard的参数！"),
        (_this.position = void 0),
        _this
      );
    }
    return (
      _createClass(CreateBillboard, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              (this.state = "startCreate");
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  ((that.position = evt.clone()),
                  (that.entity = that.createBillboard(that.position)),
                  that.handler &&
                    (that.handler.destroy(), (that.handler = void 0)),
                  that.prompt &&
                    (that.prompt.destroy(), (that.prompt = void 0)),
                  (that.state = "endCreate"),
                  that.setRightToolState(!0),
                  callback && callback(that.entity));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.prompt.update(evt.endPosition, "单击新增"),
                  (that.state = "creating"),
                  that.setRightToolState(!1);
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "endCreate",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "endCreate");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state || "creating" == this.state
              ? this.destroy()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "createByPositions",
          value: function (lnglatArr, callback) {
            var position;
            lnglatArr &&
              ((this.state = "startCreate"),
              (position = void 0),
              (position =
                lnglatArr instanceof Cesium.Cartesian3
                  ? lnglatArr.clone()
                  : Cesium.Cartesian3.fromDegrees(
                      Number(lnglatArr[0]),
                      Number(lnglatArr[1]),
                      Number(lnglatArr[2] || 0)
                    )) &&
                ((this.position = position.clone()),
                (this.entity = this.createBillboard(this.position)),
                callback && callback(this.entity),
                (this.state = "endCreate")));
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            var billboard, heightReference;
            style &&
              ((billboard = this.entity.billboard),
              null != style.image && (billboard.image = style.image),
              null != style.heightReference &&
                ((heightReference =
                  (heightReference = 1) == this.style.heightReference
                    ? 1
                    : this.style.heightReference),
                (billboard.heightReference = heightReference)),
              null != style.heightReference &&
                (billboard.heightReference =
                  null == style.heightReference
                    ? 1
                    : Number(this.style.heightReference)),
              null != style.scale && (billboard.scale = Number(style.scale)),
              style.color &&
                ((heightReference = (heightReference =
                  style.color instanceof Cesium.Color
                    ? style.color
                    : Cesium.Color.fromCssColorString(style.color)).withAlpha(
                  style.colorAlpha || 1
                )),
                (billboard.color = heightReference)),
              (this.style = Object.assign(this.style, style)));
          },
        },
        {
          key: "getStyle",
          value: function () {
            var heightReference,
              obj = {},
              billboard = this.entity.billboard;
            return (
              (obj.image = this.style.image),
              billboard.heightReference &&
                ((heightReference = billboard.heightReference.getValue()),
                (obj.heightReference = Number(heightReference))),
              (obj.scale = billboard.scale.getValue()),
              billboard.color &&
                ((heightReference = billboard.color.getValue()),
                (obj.colorAlpha = heightReference.alpha),
                (obj.color = new Cesium.Color(
                  heightReference.red,
                  heightReference.green,
                  heightReference.blue,
                  1
                ).toCssHexString())),
              obj
            );
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            var that, editBillboard;
            "startEdit" != this.state &&
              "editing" != this.state &&
              this.entity &&
              ((this.state = "startEdit"),
              this.modifyHandler ||
                (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              (that = this).modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  ((editBillboard = evt.id), that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.modifyHandler.setInputAction(function (evt) {
                !editBillboard ||
                  ((evt = that.getCatesian3FromPX(
                    evt.endPosition,
                    that.viewer
                  )) &&
                    (editBillboard.position.setValue(evt.clone()),
                    (that.position = evt.clone()),
                    (that.state = "editing"),
                    callback && callback()));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.modifyHandler.setInputAction(function (evt) {
                editBillboard &&
                  (that.forbidDrawWorld(!1),
                  that.modifyHandler &&
                    (that.modifyHandler.destroy(),
                    (that.modifyHandler = void 0),
                    (that.state = "editing")));
              }, Cesium.ScreenSpaceEventType.LEFT_UP));
          },
        },
        {
          key: "endEdit",
          value: function (callback) {
            this.modifyHandler &&
              (this.modifyHandler.destroy(),
              (this.modifyHandler = void 0),
              callback && callback(this.entity)),
              (this.state = "endEdit");
          },
        },
        {
          key: "createBillboard",
          value: function (cartesian) {
            if (cartesian)
              return (
                ((cartesian = this.viewer.entities.add({
                  position: cartesian,
                  billboard: {
                    color: this.style.color
                      ? this.style.color instanceof Cesium.Color
                        ? this.style.color
                        : Cesium.Color.fromCssColorString(
                            this.style.color
                          ).withAlpha(this.style.colorAlpha || 1)
                      : Cesium.Color.WHITE,
                    image: this.style.image || "../img/mark4.png",
                    scale: this.style.scale || 1,
                    pixelOffset: this.style.pixelOffset,
                    heightReference:
                      null == this.style.heightReference
                        ? 1
                        : Number(this.style.heightReference),
                    verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
                  },
                })).objId = this.objId),
                cartesian
              );
          },
        },
        {
          key: "remove",
          value: function () {
            this.entity &&
              ((this.state = "no"),
              this.viewer.entities.remove(this.entity),
              (this.entity = void 0));
          },
        },
        {
          key: "getPositions",
          value: function (isWgs84) {
            return [
              isWgs84 ? util$1.cartesianToLnglat(this.position) : this.position,
            ];
          },
        },
        {
          key: "setPosition",
          value: function (p) {
            var position = void 0,
              position =
                p instanceof Cesium.Cartesian3
                  ? p
                  : Cesium.Cartesian3.fromDegrees(p[0], p[1], p[2] || 0);
            this.entity.position.setValue(position.clone()),
              (this.position = position.clone());
          },
        },
      ]),
      CreateBillboard
    );
  })(),
  CreateCircle = (function () {
    _inherits(CreateCircle, BasePlot);
    var _super = _createSuper(CreateCircle);
    function CreateCircle(viewer, opt) {
      var _this;
      return (
        _classCallCheck(this, CreateCircle),
        ((_this = _super.call(this, viewer, opt)).opt = opt || {}),
        (_this.type = "circle"),
        (_this.objId = Number(
          new Date().getTime() + "" + Number(1e3 * Math.random()).toFixed(0)
        )),
        (_this.viewer = viewer),
        (_this.floatPoint = void 0),
        (_this.centerPoint = void 0),
        (_this.position = void 0),
        (_this.floatPosition = void 0),
        (_this.radius = 0.001),
        (_this.modifyPoint = void 0),
        (_this.pointArr = []),
        _this
      );
    }
    return (
      _createClass(CreateCircle, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              (this.state = "startCreate");
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  (that.centerPoint
                    ? that.entity &&
                      (that.endCreate(), callback && callback(that.entity))
                    : ((that.position = evt),
                      (that.centerPoint = that.createPoint(evt)),
                      (that.centerPoint.typeAttr = "center"),
                      (that.floatPoint = that.createPoint(evt.clone())),
                      (that.floatPosition = evt.clone()),
                      (that.floatPoint.typeAttr = "float"),
                      (that.entity = that.createCircle(
                        that.position,
                        that.radius
                      ))),
                  that.setRightToolState(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                var cartesian;
                that.centerPoint
                  ? ((that.state = "creating"),
                    that.prompt.update(evt.endPosition, "再次单击结束"),
                    (cartesian = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (that.floatPoint &&
                        (that.floatPoint.position.setValue(cartesian),
                        (that.floatPosition = cartesian.clone())),
                      (that.radius = Cesium.Cartesian3.distance(
                        cartesian,
                        that.position
                      ))))
                  : (that.prompt.update(evt.endPosition, "单击开始绘制"),
                    that.setRightToolState(!1));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "createByPositions",
          value: function (lnglatArr, callback) {
            if (lnglatArr && !(lnglatArr.length < 1)) {
              if (((this.state = "startCreate"), Array.isArray(lnglatArr))) {
                var positions = [];
                if (
                  !(positions =
                    lnglatArr[0] instanceof Cesium.Cartesian3
                      ? lnglatArr
                      : util$1.lnglatsToCartesians(lnglatArr)) ||
                  positions.length < 1
                )
                  return;
                (this.position = positions[0].clone()),
                  (this.radius = Cesium.Cartesian3.distance(
                    this.position,
                    positions[1]
                  )),
                  (this.floatPosition = positions[1].clone());
              } else
                (this.position = lnglatArr.position),
                  (this.radius = lnglatArr.radius),
                  (this.floatPosition = util$1.getPositionByLength());
              (this.centerPoint = this.createPoint(this.position)),
                (this.centerPoint.typeAttr = "center"),
                (this.floatPoint = this.createPoint(this.floatPosition)),
                (this.floatPoint.typeAttr = "float"),
                (this.entity = this.createCircle(this.position, this.radius)),
                (this.state = "endCreate"),
                callback && callback(this.entity);
            }
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            var that;
            "startEdit" != this.state &&
              "editing" != this.state &&
              this.entity &&
              ((this.state = "startEdit"),
              this.modifyHandler ||
                (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              (that = this).floatPoint && (that.floatPoint.show = !0),
              that.centerPoint && (that.centerPoint.show = !0),
              this.modifyHandler.setInputAction(function (evt) {
                that.entity &&
                  ((that.state = "editing"),
                  (evt = that.viewer.scene.pick(evt.position)),
                  Cesium.defined(evt) && evt.id
                    ? (evt.id.objId || (that.modifyPoint = evt.id),
                      that.forbidDrawWorld(!0))
                    : (that.floatPoint && (that.floatPoint.show = !1),
                      that.centerPoint && (that.centerPoint.show = !1),
                      that.modifyHandler &&
                        (that.modifyHandler.destroy(),
                        (that.modifyHandler = void 0))));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.modifyHandler.setInputAction(function (evt) {
                var subtract;
                !that.modifyPoint ||
                  ((evt = that.getCatesian3FromPX(
                    evt.endPosition,
                    that.viewer
                  )) &&
                    ((that.state = "editing"),
                    "center" == that.modifyPoint.typeAttr
                      ? ((subtract = Cesium.Cartesian3.subtract(
                          evt,
                          that.position,
                          new Cesium.Cartesian3()
                        )),
                        (that.position = evt),
                        that.centerPoint.position.setValue(that.position),
                        that.entity.position.setValue(that.position),
                        (that.floatPosition = Cesium.Cartesian3.add(
                          that.floatPosition,
                          subtract,
                          new Cesium.Cartesian3()
                        )),
                        that.floatPoint.position.setValue(that.floatPosition))
                      : ((that.floatPosition = evt),
                        that.floatPoint.position.setValue(that.floatPosition),
                        (that.radius = Cesium.Cartesian3.distance(
                          that.floatPosition,
                          that.position
                        ))),
                    callback && callback()));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.modifyHandler.setInputAction(function (evt) {
                that.modifyPoint &&
                  ((that.modifyPoint = void 0),
                  that.forbidDrawWorld(!1),
                  (that.state = "editing"));
              }, Cesium.ScreenSpaceEventType.LEFT_UP));
          },
        },
        {
          key: "endCreate",
          value: function () {
            (this.state = "endCreate"),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.floatPoint && (this.floatPoint.show = !1),
              this.centerPoint && (this.centerPoint.show = !1),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0));
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state || "creating" == this.state
              ? this.destroy()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "endEdit",
          value: function (callback) {
            this.floatPoint && (this.floatPoint.show = !1),
              this.centerPoint && (this.centerPoint.show = !1),
              this.modifyHandler &&
                (this.modifyHandler.destroy(),
                (this.modifyHandler = void 0),
                callback && callback(this.entity)),
              this.forbidDrawWorld(!1),
              (this.state = "endEdit");
          },
        },
        {
          key: "createCircle",
          value: function () {
            var that = this,
              defauteObj = {
                semiMajorAxis: new Cesium.CallbackProperty(function () {
                  return that.radius;
                }, !1),
                semiMinorAxis: new Cesium.CallbackProperty(function () {
                  return that.radius;
                }, !1),
                material:
                  this.style.color instanceof Cesium.Color
                    ? this.style.color
                    : this.style.color
                    ? Cesium.Color.fromCssColorString(
                        this.style.color
                      ).withAlpha(this.style.colorAlpha || 1)
                    : Cesium.Color.WHITE,
                outlineColor:
                  this.style.outlineColor instanceof Cesium.Color
                    ? this.style.outlineColor
                    : this.style.outlineColor
                    ? Cesium.Color.fromCssColorString(
                        this.style.outlineColor
                      ).withAlpha(this.style.outlineColorAlpha || 1)
                    : Cesium.Color.BLACK,
                outline: this.style.outline,
                heightReference: this.style.heightReference,
                outlineWidth: this.style.outlineWidth,
                fill: this.style.fill,
              },
              defauteObj = this.viewer.entities.add({
                position: this.position,
                ellipse: defauteObj,
              });
            return (defauteObj.objId = this.objId), defauteObj;
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            var color;
            style &&
              ((color = (color = Cesium.Color.fromCssColorString(
                style.color || "#ffff00"
              )).withAlpha(style.colorAlpha)),
              (this.entity.ellipse.material = color),
              (this.entity.ellipse.outline = style.outline),
              (this.entity.ellipse.outlineWidth = style.outlineWidth),
              (color = (color = Cesium.Color.fromCssColorString(
                style.outlineColor || "#000000"
              )).withAlpha(style.outlineColorAlpha)),
              (this.entity.ellipse.outlineColor = color),
              (this.entity.ellipse.heightReference = Number(
                style.heightReference
              )),
              0 == style.heightReference &&
                ((this.entity.ellipse.height = Number(style.height)),
                this.updatePointHeight(style.height)),
              (this.entity.ellipse.fill = null == style.fill || style.fill),
              (this.style = Object.assign(this.style, style)));
          },
        },
        {
          key: "getStyle",
          value: function () {
            var obj = {},
              ellipse = this.entity.ellipse,
              color = ellipse.material.color.getValue(),
              color =
                ((obj.colorAlpha = color.alpha),
                (obj.color = new Cesium.Color(
                  color.red,
                  color.green,
                  color.blue,
                  1
                ).toCssHexString()),
                ellipse.outline && (obj.outline = ellipse.outline.getValue()),
                (obj.outlineWidth = ellipse.outlineWidth._value),
                ellipse.outlineColor.getValue());
            return (
              (obj.outlineColorAlpha = color.alpha),
              (obj.outlineColor = new Cesium.Color(
                color.red,
                color.green,
                color.blue,
                1
              ).toCssHexString()),
              ellipse.height && (obj.height = ellipse.height.getValue()),
              ellipse.fill && (obj.fill = ellipse.fill.getValue()),
              (obj.heightReference = ellipse.heightReference.getValue()),
              obj
            );
          },
        },
        {
          key: "destroy",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              this.entity &&
                (this.viewer.entities.remove(this.entity),
                (this.entity = void 0)),
              this.floatPoint &&
                (this.viewer.entities.remove(this.floatPoint),
                (this.floatPoint = void 0)),
              this.centerPoint &&
                (this.viewer.entities.remove(this.centerPoint),
                (this.centerPoint = void 0)),
              (this.style = void 0),
              (this.modifyPoint = void 0),
              this.prompt && this.prompt.destroy(),
              this.forbidDrawWorld(!1),
              (this.state = "no");
          },
        },
        {
          key: "updatePointHeight",
          value: function (h) {
            var centerP = this.centerPoint.position.getValue(),
              floatP = this.floatPoint.position.getValue(),
              centerP = util$1.updatePositionsHeight(
                [centerP],
                Number(this.style.height)
              )[0],
              floatP = util$1.updatePositionsHeight(
                [floatP],
                Number(this.style.height)
              )[0];
            this.centerPoint.position.setValue(centerP),
              this.floatPoint.position.setValue(floatP);
          },
        },
        {
          key: "getPositions",
          value: function (isWgs84) {
            return isWgs84
              ? util$1.cartesiansToLnglats(
                  [this.position, this.floatPosition],
                  this.viewer
                )
              : [this.position, this.floatPosition];
          },
        },
      ]),
      CreateCircle
    );
  })(),
  CreateGltfModel = (function () {
    _inherits(CreateGltfModel, BasePlot);
    var _super = _createSuper(CreateGltfModel);
    function CreateGltfModel(viewer, opt) {
      var _this;
      _classCallCheck(this, CreateGltfModel),
        ((_this = _super.call(this, viewer, opt)).opt = opt || {}),
        (_this.type = "gltfModel"),
        (_this.viewer = viewer);
      return (
        (_this.style = Object.assign(
          {
            heading: 0,
            pitch: 0,
            roll: 0,
            minimumPixelSize: 24,
            maximumScale: 120,
          },
          _this.opt.style || {}
        )),
        _this.style.uri
          ? ((_this.modelUri = _this.style.uri), (_this.entity = void 0), _this)
          : (console.warn("请输入模型地址！"),
            _possibleConstructorReturn(_this))
      );
    }
    return (
      _createClass(CreateGltfModel, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              (this.state = "startCreate");
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  ((that.entity.position = evt), (that.position = evt.clone())),
                  that.endCreate(),
                  that.setRightToolState(!0),
                  callback && callback(that.entity);
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.prompt.update(evt.endPosition, "单击新增"),
                  that.setRightToolState(!1),
                  (that.state = "creating");
                evt = that.getCatesian3FromPX(evt.endPosition, that.viewer, [
                  that.entity,
                ]);
                evt &&
                  (that.entity
                    ? (that.entity.position = evt)
                    : (that.entity = that.createGltfModel(evt.clone())));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "createByPositions",
          value: function (lnglatArr, callback) {
            lnglatArr &&
              ((this.state = "startCreate"),
              lnglatArr instanceof Cesium.Cartesian3
                ? (this.position = lnglatArr)
                : (this.position = Cesium.Cartesian3.fromDegrees(
                    lnglatArr[0],
                    lnglatArr[1],
                    lnglatArr[2] || 0
                  )),
              (this.entity = this.createGltfModel(this.position)),
              callback(this.entity),
              (this.state = "endCreate"));
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            var that, eidtModel;
            "startEdit" != this.state &&
              "editing" != this.state &&
              (this.modifyHandler ||
                (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              ((that = this).state = "startEdit"),
              this.modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  ((eidtModel = evt.id), that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.modifyHandler.setInputAction(function (evt) {
                !eidtModel ||
                  ((evt = that.getCatesian3FromPX(
                    evt.endPosition,
                    that.viewer,
                    [that.entity]
                  )) &&
                    (that.entity &&
                      (that.entity.position.setValue(evt),
                      (that.position = evt.clone())),
                    (that.state = "editing"),
                    callback && callback()));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.modifyHandler.setInputAction(function (evt) {
                eidtModel &&
                  (that.forbidDrawWorld(!1),
                  that.modifyHandler &&
                    (that.modifyHandler.destroy(),
                    (that.modifyHandler = void 0)),
                  (that.state = "editing"));
              }, Cesium.ScreenSpaceEventType.LEFT_UP));
          },
        },
        {
          key: "endCreate",
          value: function () {
            (this.state = "endCreate"),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0));
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state || "creating" == this.state
              ? this.destroy()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "endEdit",
          value: function (callback) {
            this.modifyHandler &&
              (this.modifyHandler.destroy(),
              (this.modifyHandler = void 0),
              callback && callback(this.entity)),
              this.forbidDrawWorld(!1),
              (this.state = "endEdit");
          },
        },
        {
          key: "createGltfModel",
          value: function (cartesian) {
            var heading, pitch, roll;
            if (cartesian)
              return (
                (heading = Cesium.Math.toRadians(this.style.heading)),
                (pitch = Cesium.Math.toRadians(this.style.pitch)),
                (roll = Cesium.Math.toRadians(this.style.roll)),
                (heading = new Cesium.HeadingPitchRoll(heading, pitch, roll)),
                (pitch = Cesium.Transforms.headingPitchRollQuaternion(
                  cartesian,
                  heading
                )),
                ((roll = this.viewer.entities.add({
                  position: cartesian,
                  orientation: pitch,
                  model: {
                    uri: this.modelUri,
                    minimumPixelSize: this.style.minimumPixelSize,
                    maximumScale: this.style.maximumScale,
                    scale: this.style.scale || 1,
                    heightReference: this.style.heightReference,
                  },
                })).objId = this.objId),
                roll
              );
          },
        },
        {
          key: "getPositions",
          value: function (isWgs84) {
            return isWgs84
              ? util$1.cartesianToLnglat(this.position, this.viewer)
              : this.position;
          },
        },
        {
          key: "getStyle",
          value: function () {
            var obj = {},
              model = this.entity.model,
              orientation =
                ((obj.minimumPixelSize = model.minimumPixelSize.getValue()),
                this.entity.orientation.getValue()),
              p = this.entity.position.getValue(this.viewer.clock.currentTime),
              p = util$1.oreatationToHpr(p.clone(), orientation, !0) || {},
              orientation =
                ((obj.heading =
                  (p.heading || 0) < 360 ? p.heading + 360 : p.heading),
                (obj.pitch = p.pitch || 0),
                (obj.roll = p.roll || 0),
                (obj.scale = model.scale.getValue()),
                (obj.uri = model.uri.getValue()),
                this.entity.heightReference &&
                  this.entity.heightReference.getValue());
            return (
              null != orientation &&
                (obj.heightReference = Number(orientation)),
              obj
            );
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            style &&
              (this.setOrientation(style.heading, style.pitch, style.roll),
              this.entity.model.scale.setValue(
                null == style.scale ? 1 : style.scale
              ),
              style.uri && this.entity.model.uri.setValue(style.uri),
              null != style.heightReference &&
                this.entity.model.heightReference.setValue(
                  Number(style.heightReference)
                ),
              (this.style = Object.assign(this.style, style)));
          },
        },
        {
          key: "setOrientation",
          value: function (h, p, r) {
            (p = p || 0),
              (r = r || 0),
              (this.style.heading = h = h || 0),
              (this.style.pitch = p),
              (this.style.roll = r);
            (h = Cesium.Math.toRadians(h || 0)),
              (p = Cesium.Math.toRadians(p || 0)),
              (r = Cesium.Math.toRadians(r || 0)),
              (h = new Cesium.HeadingPitchRoll(h, p, r)),
              (p = this.entity.position._value),
              (r = Cesium.Transforms.headingPitchRollQuaternion(p, h));
            this.entity && (this.entity.orientation = r);
          },
        },
        {
          key: "remove",
          value: function () {
            this.entity &&
              ((this.state = "no"),
              this.viewer.entities.remove(this.entity),
              (this.entity = void 0));
          },
        },
        {
          key: "destroy",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              this.entity &&
                (this.viewer.entities.remove(this.entity),
                (this.entity = void 0)),
              (this.style = void 0),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0));
          },
        },
      ]),
      CreateGltfModel
    );
  })(),
  CreateLabel = (function () {
    _inherits(CreateLabel, BasePlot);
    var _super = _createSuper(CreateLabel);
    function CreateLabel(viewer, opt) {
      var _this;
      return (
        _classCallCheck(this, CreateLabel),
        ((_this = _super.call(this, viewer, opt)).opt = opt || {}),
        (_this.type = "label"),
        (_this.viewer = viewer),
        (_this.position = void 0),
        _this
      );
    }
    return (
      _createClass(CreateLabel, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle));
            var that = this;
            (this.state = "startCreate"),
              this.handler ||
                (this.handler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              this.handler.setInputAction(function (evt) {
                evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  ((that.entity = that.createLabel(evt.clone())),
                  (that.position = evt.clone()),
                  that.endCreate(),
                  that.setRightToolState(!0),
                  callback && callback(that.entity));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.prompt.update(evt.endPosition, "单击新增"),
                  that.setRightToolState(!1),
                  (that.state = "creating");
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "endCreate",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "endCreate");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state || "creating" == this.state
              ? this.destroy()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "createByPositions",
          value: function (lnglatArr, callback) {
            lnglatArr &&
              ((this.state = "startCreate"),
              (lnglatArr =
                lnglatArr instanceof Cesium.Cartesian3
                  ? lnglatArr
                  : Cesium.Cartesian3.fromDegrees(
                      lnglatArr[0],
                      lnglatArr[1],
                      lnglatArr[2]
                    )),
              (this.position = lnglatArr) &&
                ((this.entity = this.createLabel(lnglatArr, this.style.text)),
                callback && callback(this.entity),
                (this.state = "endCreate")));
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            var fillColor;
            style &&
              (style.fillColor &&
                ((fillColor = (fillColor =
                  style.fillColor instanceof Cesium.Color
                    ? style.fillColor
                    : Cesium.Color.fromCssColorString(
                        style.fillColor || "#ffff00"
                      )).withAlpha(style.fillColorAlpha || 1)),
                (this.entity.label.fillColor = fillColor)),
              (this.entity.label.outlineWidth = style.outlineWidth),
              style.backgroundColor &&
                ((fillColor = (fillColor =
                  style.backgroundColor instanceof Cesium.Color
                    ? style.backgroundColor
                    : Cesium.Color.fromCssColorString(
                        style.backgroundColor || "#000000"
                      )).withAlpha(style.backgroundColorAlpha || 1)),
                (this.entity.label.backgroundColor = fillColor)),
              style.outlineColor &&
                ((fillColor = (fillColor =
                  style.outlineColor instanceof Cesium.Color
                    ? style.outlineColor
                    : Cesium.Color.fromCssColorString(
                        style.outlineColor || "#000000"
                      )).withAlpha(style.outlineColorAlpha || 1)),
                (this.entity.label.outlineColor = fillColor)),
              null != style.heightReference &&
                (this.entity.label.heightReference = Number(
                  style.heightReference
                )),
              style.pixelOffset &&
                (this.entity.label.pixelOffset = style.pixelOffset),
              style.text && (this.entity.label.text = style.text),
              null != style.showBackground &&
                (this.entity.label.showBackground = Boolean(
                  style.showBackground
                )),
              style.scale && (this.entity.label.scale = Number(style.scale)),
              (this.style = Object.assign(this.style, style)));
          },
        },
        {
          key: "getStyle",
          value: function () {
            var obj = {},
              label = this.entity.label,
              fillColor = label.fillColor.getValue();
            return (
              (obj.fillColorAlpha = fillColor.alpha),
              (obj.fillColor = new Cesium.Color(
                fillColor.red,
                fillColor.green,
                fillColor.blue,
                1
              ).toCssHexString()),
              null != label.outlineWidth &&
                (obj.outlineWidth = label.outlineWidth._value),
              null != label.showBackground &&
                (obj.showBackground = Boolean(label.showBackground.getValue())),
              label.backgroundColor &&
                ((fillColor = label.backgroundColor.getValue()),
                (obj.backgroundColorAlpha = fillColor.alpha),
                (obj.backgroundColor = new Cesium.Color(
                  fillColor.red,
                  fillColor.green,
                  fillColor.blue,
                  1
                ).toCssHexString())),
              label.outlineColor &&
                ((fillColor = label.outlineColor.getValue()),
                (obj.outlineColorAlpha = fillColor.alpha),
                (obj.outlineColor = new Cesium.Color(
                  fillColor.red,
                  fillColor.green,
                  fillColor.blue,
                  1
                ).toCssHexString())),
              null != label.heightReference &&
                (obj.heightReference = label.heightReference.getValue()),
              label.pixelOffset &&
                (obj.pixelOffset = label.pixelOffset.getValue()),
              label.scale && (obj.scale = label.scale.getValue()),
              (obj.text = label.text.getValue()),
              obj
            );
          },
        },
        {
          key: "getPositions",
          value: function (isWgs84) {
            return isWgs84
              ? util$1.cartesianToLnglat(this.position)
              : this.position;
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            var that, editLabel;
            "startEdit" != this.state &&
              "editing" != this.state &&
              this.entity &&
              ((this.state = "startEdit"),
              this.modifyHandler ||
                (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              (that = this).modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  ((editLabel = evt.id), that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.modifyHandler.setInputAction(function (evt) {
                !editLabel ||
                  ((evt = that.getCatesian3FromPX(
                    evt.endPosition,
                    that.viewer
                  )) &&
                    (that.entity &&
                      (that.entity.position.setValue(evt),
                      (that.position = evt),
                      (that.state = "editing")),
                    callback && callback()));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.modifyHandler.setInputAction(function (evt) {
                editLabel &&
                  (that.forbidDrawWorld(!1),
                  that.modifyHandler &&
                    (that.modifyHandler.destroy(),
                    (that.modifyHandler = void 0),
                    (that.state = "editing")));
              }, Cesium.ScreenSpaceEventType.LEFT_UP));
          },
        },
        {
          key: "endEdit",
          value: function (callback) {
            this.modifyHandler &&
              (this.modifyHandler.destroy(),
              (this.modifyHandler = void 0),
              callback && callback(this.entity)),
              this.forbidDrawWorld(!1),
              (this.state = "endEdit");
          },
        },
        {
          key: "createLabel",
          value: function (cartesian) {
            if (cartesian)
              return (
                ((cartesian = this.viewer.entities.add({
                  position: cartesian,
                  label: {
                    text: this.style.text || "--",
                    fillColor: this.style.fillColor
                      ? Cesium.Color.fromCssColorString(
                          this.style.fillColor
                        ).withAlpha(this.style.fillColorAlpha || 1)
                      : Cesium.Color.WHITE,
                    backgroundColor: this.style.backgroundColor
                      ? Cesium.Color.fromCssColorString(
                          this.style.backgroundColor
                        ).withAlpha(this.style.backgroundColorAlpha || 1)
                      : Cesium.Color.WHITE,
                    style: Cesium.LabelStyle.FILL,
                    outlineWidth: this.style.outlineWidth || 4,
                    scale: this.style.scale || 1,
                    pixelOffset:
                      this.style.pixelOffset || Cesium.Cartesian2.ZERO,
                    showBackground: this.style.showBackground,
                    heightReference: this.style.heightReference || 0,
                    disableDepthTestDistance: Number.MAX_VALUE,
                  },
                })).objId = this.objId),
                cartesian
              );
          },
        },
      ]),
      CreateLabel
    );
  })(),
  CreatePoint = (function () {
    _inherits(CreatePoint, BasePlot);
    var _super = _createSuper(CreatePoint);
    function CreatePoint(viewer, opt) {
      _classCallCheck(this, CreatePoint),
        ((_this = _super.call(this, viewer, opt)).opt = opt || {}),
        (_this.type = "point"),
        (_this.viewer = viewer);
      var _this,
        opt = { color: Cesium.Color.AQUA, pixelSize: 10, outlineWidth: 1 };
      return (
        (_this.style = Object.assign(opt, _this.style || {})),
        (_this.position = void 0),
        _this
      );
    }
    return (
      _createClass(CreatePoint, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              (this.state = "startCreate");
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  ((that.entity = that.createPoint(evt)),
                  (that.position = evt),
                  that.handler &&
                    (that.handler.destroy(), (that.handler = void 0)),
                  that.prompt &&
                    (that.prompt.destroy(), (that.prompt = void 0)),
                  (that.state = "endCreate"),
                  that.setRightToolState(!0),
                  callback && callback(that.entity));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.prompt.update(evt.endPosition, "单击新增"),
                  that.setRightToolState(!1),
                  (that.state = "creating");
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "endCreate",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "endCreate");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state || "creating" == this.state
              ? this.destroy()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "createByPositions",
          value: function (lnglatArr, callback) {
            lnglatArr &&
              ((this.state = "startCreate"),
              (lnglatArr =
                lnglatArr instanceof Cesium.Cartesian3
                  ? lnglatArr
                  : Cesium.Cartesian3.fromDegrees(
                      lnglatArr[0],
                      lnglatArr[1],
                      lnglatArr[2]
                    )),
              (this.position = lnglatArr) &&
                ((this.entity = this.createPoint(lnglatArr)),
                callback && callback(this.entity),
                (this.state = "endCreate")));
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            var color;
            style &&
              (style.color &&
                ((color = (color = Cesium.Color.fromCssColorString(
                  style.color || "#ffff00"
                )).withAlpha(style.colorAlpha)),
                (this.entity.point.color = color)),
              (this.entity.point.outlineWidth = Number(style.outlineWidth)),
              style.outlineColor &&
                ((color = (color = Cesium.Color.fromCssColorString(
                  style.outlineColor || "#000000"
                )).withAlpha(style.outlineColorAlpha)),
                (this.entity.point.outlineColor = color)),
              (this.entity.point.heightReference = Number(
                style.heightReference
              )),
              (this.entity.point.pixelSize = Number(style.pixelSize)),
              (this.style = Object.assign(this.style, style)));
          },
        },
        {
          key: "getStyle",
          value: function () {
            var obj = {},
              point = this.entity.point,
              color = point.color.getValue(),
              color =
                ((obj.colorAlpha = color.alpha),
                (obj.color = new Cesium.Color(
                  color.red,
                  color.green,
                  color.blue,
                  1
                ).toCssHexString()),
                (obj.outlineWidth = point.outlineWidth._value),
                point.outlineColor.getValue());
            return (
              (obj.outlineColorAlpha = color.alpha),
              (obj.outlineColor = new Cesium.Color(
                color.red,
                color.green,
                color.blue,
                1
              ).toCssHexString()),
              null != point.heightReference &&
                (obj.heightReference = point.heightReference.getValue()),
              (obj.pixelSize = Number(point.pixelSize)),
              obj
            );
          },
        },
        {
          key: "getPositions",
          value: function (isWgs84) {
            return [
              isWgs84 ? util$1.cartesianToLnglat(this.position) : this.position,
            ];
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            var that, editPoint;
            "startEdit" != this.state &&
              "editing" != this.state &&
              this.entity &&
              ((this.state = "startEdit"),
              this.modifyHandler ||
                (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              (that = this).modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  ((editPoint = evt.id), that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.modifyHandler.setInputAction(function (evt) {
                !editPoint ||
                  ((evt = that.getCatesian3FromPX(
                    evt.endPosition,
                    that.viewer
                  )) &&
                    (that.entity &&
                      (that.entity.position.setValue(evt),
                      (that.position = evt),
                      (that.state = "editing")),
                    callback && callback()));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.modifyHandler.setInputAction(function (evt) {
                editPoint &&
                  (that.forbidDrawWorld(!1),
                  that.modifyHandler &&
                    (that.modifyHandler.destroy(),
                    (that.modifyHandler = void 0),
                    (that.state = "editing")));
              }, Cesium.ScreenSpaceEventType.LEFT_UP));
          },
        },
        {
          key: "endEdit",
          value: function (callback) {
            this.modifyHandler &&
              (this.modifyHandler.destroy(),
              (this.modifyHandler = void 0),
              callback && callback(this.entity)),
              this.forbidDrawWorld(!1),
              (this.state = "endEdit");
          },
        },
        {
          key: "createPoint",
          value: function (cartesian) {
            if (cartesian)
              return (
                ((cartesian = this.viewer.entities.add({
                  position: cartesian,
                  point: {
                    color:
                      this.style.color instanceof Cesium.Color
                        ? this.style.color
                        : this.style.color
                        ? Cesium.Color.fromCssColorString(
                            this.style.color
                          ).withAlpha(this.style.colorAlpha || 1)
                        : Cesium.Color.WHITE,
                    outlineColor:
                      this.style.outlineColor instanceof Cesium.Color
                        ? this.style.outlineColor
                        : this.style.outlineColor
                        ? Cesium.Color.fromCssColorString(
                            this.style.outlineColor
                          ).withAlpha(this.style.outlineColorAlpha || 1)
                        : Cesium.Color.BLACK,
                    outlineWidth: this.style.outlineWidth || 4,
                    pixelSize: this.style.pixelSize || 20,
                    disableDepthTestDistance: Number.MAX_VALUE,
                  },
                })).objId = this.objId),
                cartesian
              );
          },
        },
      ]),
      CreatePoint
    );
  })(),
  CreatePolygon = (function () {
    _inherits(CreatePolygon, BasePlot);
    var _super = _createSuper(CreatePolygon);
    function CreatePolygon(viewer, opt) {
      var _this;
      _classCallCheck(this, CreatePolygon),
        ((_this = _super.call(this, viewer, opt)).opt = opt || {}),
        (_this.type = "polygon"),
        (_this.viewer = viewer),
        (_this.entity = void 0),
        (_this.outline = void 0);
      return (
        (_this.style = Object.assign(
          { outlineColor: "#000000", outlineWidth: 2 },
          _this.style || {}
        )),
        _this
      );
    }
    return (
      _createClass(CreatePolygon, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              (this.state = "startCreate");
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                var evt = that.getCatesian3FromPX(
                  evt.position,
                  that.viewer,
                  []
                );
                evt &&
                  (that.movePush &&
                    (that.positions.pop(), (that.movePush = !1)),
                  that.positions.push(evt),
                  ((evt = that.createPoint(evt)).wz =
                    that.positions.length - 1),
                  that.controlPoints.push(evt),
                  that.setRightToolState(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.positions.length < 1
                  ? (that.prompt.update(evt.endPosition, "单击开始绘制"),
                    (that.state = "startCreate"),
                    that.setRightToolState(!1))
                  : (that.prompt &&
                      that.prompt.update(
                        evt.endPosition,
                        "双击结束，右键取消上一步"
                      ),
                    (evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer,
                      []
                    )),
                    1 <= that.positions.length &&
                      ((that.state = "creating"),
                      that.movePush
                        ? (that.positions[that.positions.length - 1] = evt)
                        : (that.positions.push(evt), (that.movePush = !0)),
                      2 != that.positions.length ||
                        Cesium.defined(that.outline) ||
                        (that.outline = that.createPolyline()),
                      3 != that.positions.length ||
                        Cesium.defined(that.entity) ||
                        ((that.entity = that.createPolygon(that.style)),
                        !that.style.outline &&
                          that.outline &&
                          (that.outline.show = !1),
                        (that.entity.objId = that.objId))));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.handler.setInputAction(function (evt) {
                that.entity &&
                  (that.positions.splice(that.positions.length - 2, 1),
                  that.viewer.entities.remove(that.controlPoints.pop()),
                  2 == that.positions.length &&
                    that.entity &&
                    (that.viewer.entities.remove(that.entity),
                    (that.entity = void 0),
                    that.outline && (that.outline.show = !0)),
                  1 == that.positions.length &&
                    (that.outline &&
                      (that.viewer.entities.remove(that.outline),
                      (that.outline = void 0)),
                    that.prompt &&
                      that.prompt.update(evt.endPosition, "单击开始绘制"),
                    (that.positions = []),
                    (that.movePush = !1)));
              }, Cesium.ScreenSpaceEventType.RIGHT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.entity &&
                  (that.endCreate(), callback && callback(that.entity));
              }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
          },
        },
        {
          key: "endCreate",
          value: function () {
            (this.state = "endCreate"),
              this.positions.pop(),
              this.viewer.entities.remove(this.controlPoints.pop()),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              (this.movePush = !1),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.viewer.trackedEntity = void 0),
              this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "creating" == this.state
              ? this.positions.length <= 2 && 1 == this.movePush
                ? this.destroy()
                : this.endCreate()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "createByPositions",
          value: function (lnglatArr, callback) {
            if (lnglatArr) {
              this.state = "startCreate";
              var positions =
                lnglatArr[0] instanceof Cesium.Cartesian3
                  ? lnglatArr
                  : util$1.lnglatsToCartesians(lnglatArr);
              if (positions) {
                (this.entity = this.createPolygon()),
                  (this.outline = this.createPolyline()),
                  (this.outline.show = this.style.outline),
                  (this.positions = positions);
                for (var i = 0; i < positions.length; i++) {
                  var newP = positions[i],
                    ctgc = Cesium.Cartographic.fromCartesian(positions[i]),
                    newP = this.createPoint(newP);
                  (newP.point.heightReference = this.style.heightReference),
                    (newP.ctgc = ctgc),
                    (newP.wz = this.controlPoints.length),
                    this.controlPoints.push(newP);
                }
                (this.state = "endCreate"),
                  (this.entity.objId = this.objId),
                  callback && callback(this.entity);
              }
            }
          },
        },
        {
          key: "getStyle",
          value: function () {
            var obj, color, polygon;
            if (this.entity)
              return (
                (obj = {}),
                (polygon = this.entity.polygon).material instanceof
                  Cesium.ColorMaterialProperty &&
                  ((obj.material = "common"),
                  (color = polygon.material.color.getValue()),
                  (obj.colorAlpha = color.alpha),
                  (obj.color = new Cesium.Color(
                    color.red,
                    color.green,
                    color.blue,
                    1
                  ).toCssHexString())),
                (obj.fill = !!polygon.fill && polygon.fill.getValue()),
                polygon.heightReference &&
                  ((color = polygon.heightReference.getValue()),
                  (obj.heightReference = Number(color))),
                (color =
                  null == (polygon = this.outline)
                    ? void 0
                    : polygon.polyline) && this.outline.show
                  ? ((obj.outlineWidth =
                      null == (polygon = color.width)
                        ? void 0
                        : polygon.getValue()),
                    (obj.outline = !0),
                    (polygon = color.material.color.getValue()),
                    (obj.outlineColorAlpha = polygon.alpha),
                    (obj.outlineColor = new Cesium.Color(
                      polygon.red,
                      polygon.green,
                      polygon.blue,
                      1
                    ).toCssHexString()))
                  : (obj.outline = !1),
                obj
              );
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            var outlineMaterial, outline;
            style &&
              (this.outline &&
                ((this.outline.show = style.outline),
                ((outline = this.outline.polyline).width = style.outlineWidth),
                (this.outline.clampToGround = Boolean(style.heightReference)),
                (outlineMaterial = (
                  style.outlineColor instanceof Cesium.Color
                    ? style.outlineColor
                    : Cesium.Color.fromCssColorString(style.outlineColor)
                ).withAlpha(style.outlineColorAlpha || 1)),
                (outline.material = outlineMaterial)),
              null != style.heightReference &&
                (this.entity.polygon.heightReference = Number(
                  style.heightReference
                )),
              (outline = (
                style.color instanceof Cesium.Color
                  ? style.color
                  : Cesium.Color.fromCssColorString(style.color)
              ).withAlpha(style.colorAlpha || 1)),
              (this.entity.polygon.material = outline),
              null != style.fill && (this.entity.polygon.fill = style.fill),
              (this.style = Object.assign(this.style, style)));
          },
        },
        {
          key: "createPolygon",
          value: function () {
            var that = this,
              polygonObj =
                ((this.style.color = this.style.color || Cesium.Color.WHITE),
                (this.style.outlineColor =
                  this.style.outlineColor || Cesium.Color.BLACK),
                {
                  polygon: {
                    hierarchy: new Cesium.CallbackProperty(function () {
                      return new Cesium.PolygonHierarchy(that.positions);
                    }, !1),
                    heightReference: Number(this.style.heightReference),
                    show: !0,
                    fill: null == this.style.fill || this.style.fill,
                    material:
                      this.style.color instanceof Cesium.Color
                        ? this.style.color
                        : Cesium.Color.fromCssColorString(
                            this.style.color
                          ).withAlpha(this.style.colorAlpha || 1),
                  },
                });
            return (
              this.style.heightReference ||
                ((polygonObj.polygon.height = 0),
                (polygonObj.polygon.perPositionHeight = !0)),
              this.viewer.entities.add(polygonObj)
            );
          },
        },
        {
          key: "createPolyline",
          value: function () {
            var that = this,
              line = this.viewer.entities.add({
                polyline: {
                  positions: new Cesium.CallbackProperty(function () {
                    return that.positions.concat(that.positions[0]);
                  }, !1),
                  clampToGround: Boolean(this.style.heightReference),
                  material:
                    this.style.outlineColor instanceof Cesium.Color
                      ? this.style.outlineColor
                      : Cesium.Color.fromCssColorString(
                          this.style.outlineColor
                        ).withAlpha(this.style.outlineColorAlpha || 1),
                  width: this.style.outlineWidth || 1,
                },
              });
            return (line.objId = this.objId), (line.isOutline = !0), line;
          },
        },
        {
          key: "destroy",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              this.entity &&
                (this.viewer.entities.remove(this.entity),
                (this.entity = void 0)),
              this.outline &&
                (this.viewer.entities.remove(this.outline),
                (this.outline = void 0)),
              (this.positions = []),
              (this.style = void 0),
              this.modifyPoint &&
                (this.viewer.entities.remove(this.modifyPoint),
                (this.modifyPoint = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              this.viewer.entities.remove(point);
            }
            (this.controlPoints = []),
              (this.state = "no"),
              this.prompt && this.prompt.destroy(),
              this.outline &&
                ((this.outline = void 0),
                this.viewer.entities.remove(this.outline)),
              this.forbidDrawWorld(!1);
          },
        },
      ]),
      CreatePolygon
    );
  })(),
  CreateRectangle = (function () {
    _inherits(CreateRectangle, BasePlot);
    var _super = _createSuper(CreateRectangle);
    function CreateRectangle(viewer, opt) {
      var _this;
      return (
        _classCallCheck(this, CreateRectangle),
        ((_this = _super.call(this, viewer, opt)).opt = opt || {}),
        (_this.type = "rectangle"),
        (_this.viewer = viewer),
        (_this.rightdownPoint = void 0),
        (_this.leftupPoint = void 0),
        (_this.leftup = void 0),
        (_this.rightdown = void 0),
        (_this.modifyPoint = void 0),
        (_this.pointArr = []),
        (_this.outline = void 0),
        _this
      );
    }
    return (
      _createClass(CreateRectangle, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              (this.state = "startCreate");
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                evt = that.getCatesian3FromPX(evt.position, that.viewer, []);
                if (evt) {
                  if (that.leftupPoint) {
                    if (!that.entity) return;
                    that.endCreate(), callback && callback(that.entity);
                  } else
                    (that.leftup = evt),
                      (that.leftupPoint = that.createPoint(evt)),
                      (that.leftupPoint.typeAttr = "leftup"),
                      (that.rightdownPoint = that.createPoint(evt.clone())),
                      (that.rightdown = evt.clone()),
                      (that.rightdownPoint.typeAttr = "rightdown"),
                      (that.entity = that.createRectangle()),
                      (that.outline = that.createPolyline()),
                      (that.outline.show = that.style.outline);
                  that.setRightToolState(!0);
                }
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                var cartesian;
                that.leftupPoint
                  ? (that.prompt.update(evt.endPosition, "单击结束"),
                    (cartesian = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer,
                      []
                    )) &&
                      that.rightdownPoint &&
                      (that.rightdownPoint.position.setValue(cartesian),
                      (that.rightdown = cartesian.clone()),
                      (that.state = "creating")))
                  : (that.prompt.update(evt.endPosition, "单击开始绘制"),
                    (that.state = "startCreate"),
                    that.setRightToolState(!1));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "createByPositions",
          value: function (lnglatArr, callback) {
            this.state = "startCreate";
            lnglatArr =
              lnglatArr[0] instanceof Cesium.Cartesian3
                ? lnglatArr
                : util$1.lnglatsToCartesians(lnglatArr);
            lnglatArr &&
              ((this.positions = lnglatArr),
              (this.leftup = lnglatArr[0].clone()),
              (this.leftupPoint = this.createPoint(lnglatArr[0].clone())),
              (this.leftupPoint.typeAttr = "leftup"),
              (this.rightdownPoint = this.createPoint(lnglatArr[1].clone())),
              (this.rightdown = lnglatArr[1].clone()),
              (this.rightdownPoint.typeAttr = "rightdown"),
              (this.entity = this.createRectangle()),
              (this.state = "endCreate"),
              (this.entity.objId = this.objId),
              callback && callback(this.entity));
          },
        },
        {
          key: "endCreate",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.rightdownPoint && (this.rightdownPoint.show = !1),
              this.leftupPoint && (this.leftupPoint.show = !1),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "endCreate");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state || "creating" == this.state
              ? this.destroy()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            var that;
            "startEdit" != this.state &&
              "editing" != this.state &&
              this.entity &&
              ((this.state = "startEdit"),
              this.modifyHandler ||
                (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              (that = this).rightdownPoint && (that.rightdownPoint.show = !0),
              that.leftupPoint && (that.leftupPoint.show = !0),
              this.modifyHandler.setInputAction(function (evt) {
                that.entity &&
                  ((evt = that.viewer.scene.pick(evt.position)),
                  Cesium.defined(evt) &&
                    evt.id &&
                    (evt.id.objId || (that.modifyPoint = evt.id),
                    that.forbidDrawWorld(!0)));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.modifyHandler.setInputAction(function (evt) {
                !that.modifyPoint ||
                  ((evt = that.getCatesian3FromPX(
                    evt.endPosition,
                    that.viewer,
                    [that.entity, that.modifyPoint]
                  )) &&
                    (that.state,
                    "leftup" == that.modifyPoint.typeAttr
                      ? ((that.leftup = evt),
                        that.leftupPoint.position.setValue(that.leftup),
                        that.entity.position.setValue(that.leftup))
                      : ((that.rightdown = evt),
                        that.rightdownPoint.position.setValue(that.rightdown)),
                    callback && callback()));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.modifyHandler.setInputAction(function (evt) {
                that.modifyPoint &&
                  ((that.modifyPoint = void 0),
                  that.forbidDrawWorld(!1),
                  that.state);
              }, Cesium.ScreenSpaceEventType.LEFT_UP));
          },
        },
        {
          key: "endEdit",
          value: function (callback) {
            this.rightdownPoint && (this.rightdownPoint.show = !1),
              this.leftupPoint && (this.leftupPoint.show = !1),
              this.modifyHandler &&
                (this.modifyHandler.destroy(),
                (this.modifyHandler = void 0),
                callback && callback(this.entity)),
              this.forbidDrawWorld(!1),
              (this.state = "endEdit");
          },
        },
        {
          key: "createRectangle",
          value: function () {
            var that = this,
              rectangle = this.viewer.entities.add({
                rectangle: {
                  coordinates: new Cesium.CallbackProperty(function () {
                    return Cesium.Rectangle.fromCartesianArray([
                      that.leftup,
                      that.rightdown,
                    ]);
                  }, !1),
                  heightReference: this.style.heightReference || 0,
                  show: !0,
                  fill: null == this.style.fill || this.style.fill,
                  material:
                    this.style.color instanceof Cesium.Color
                      ? this.style.color
                      : this.style.color
                      ? Cesium.Color.fromCssColorString(
                          this.style.color
                        ).withAlpha(this.style.colorAlpha || 1)
                      : Cesium.Color.WHITE,
                },
              });
            return (rectangle.objId = this.objId), rectangle;
          },
        },
        {
          key: "createPolyline",
          value: function () {
            var that = this,
              line = this.viewer.entities.add({
                polyline: {
                  positions: new Cesium.CallbackProperty(function () {
                    var ctgc_leftup = Cesium.Cartographic.fromCartesian(
                        that.leftup
                      ),
                      ctgc_rightdown = Cesium.Cartographic.fromCartesian(
                        that.rightdown
                      ),
                      p1 = Cesium.Cartesian3.fromRadians(
                        ctgc_leftup.longitude,
                        ctgc_leftup.latitude
                      );
                    return [
                      p1,
                      Cesium.Cartesian3.fromRadians(
                        ctgc_leftup.longitude,
                        ctgc_rightdown.latitude
                      ),
                      Cesium.Cartesian3.fromRadians(
                        ctgc_rightdown.longitude,
                        ctgc_rightdown.latitude
                      ),
                      Cesium.Cartesian3.fromRadians(
                        ctgc_rightdown.longitude,
                        ctgc_leftup.latitude
                      ),
                      p1,
                    ];
                  }, !1),
                  clampToGround: Boolean(this.style.heightReference),
                  material:
                    this.style.outlineColor instanceof Cesium.Color
                      ? this.style.outlineColor
                      : Cesium.Color.fromCssColorString(
                          this.style.outlineColor
                        ).withAlpha(this.style.outlineColorAlpha || 1),
                  width: this.style.outlineWidth || 1,
                },
              });
            return (line.objId = this.objId), (line.isOutline = !0), line;
          },
        },
        {
          key: "getPositions",
          value: function (isWgs84) {
            return isWgs84
              ? util$1.cartesiansToLnglats(
                  [this.leftup, this.rightdown],
                  this.viewer
                )
              : [this.leftup, this.rightdown];
          },
        },
        {
          key: "getStyle",
          value: function () {
            var _this$outline2,
              obj = {},
              rectangle = this.entity.rectangle,
              color =
                (rectangle.material instanceof Cesium.ColorMaterialProperty &&
                  ((color = rectangle.material.color.getValue()),
                  (obj.colorAlpha = color.alpha),
                  (obj.color = new Cesium.Color(
                    color.red,
                    color.green,
                    color.blue,
                    1
                  ).toCssHexString())),
                null == (color = this.outline) ? void 0 : color.polyline);
            return (
              (obj.outline =
                null == (_this$outline2 = this.outline)
                  ? void 0
                  : _this$outline2.show),
              color &&
                ((obj.outlineWidth =
                  null == (_this$outline2 = color.width)
                    ? void 0
                    : _this$outline2.getValue()),
                (_this$outline2 = color.material.color.getValue()),
                (obj.outlineColorAlpha = _this$outline2.alpha),
                (obj.outlineColor = new Cesium.Color(
                  _this$outline2.red,
                  _this$outline2.green,
                  _this$outline2.blue,
                  1
                ).toCssHexString())),
              obj.height && (obj.height = rectangle.height.getValue()),
              rectangle.fill && (obj.fill = rectangle.fill.getValue()),
              (obj.heightReference = rectangle.heightReference.getValue()),
              1 == obj.heightReference && (obj.height = void 0),
              obj
            );
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            var color;
            style &&
              (console.log("rectangle setStyle====>", style),
              (color =
                style.color instanceof Cesium.Color
                  ? style.color
                  : Cesium.Color.fromCssColorString(style.color || "#ffff00")),
              style.colorAlpha && (color = color.withAlpha(style.colorAlpha)),
              (this.entity.rectangle.material = color),
              this.outline &&
                ((this.outline.show = style.outline),
                (this.outline.polyline.width = style.outlineWidth || 1),
                (color = (color =
                  style.outlineColor instanceof Cesium.Color
                    ? style.outlineColor
                    : Cesium.Color.fromCssColorString(
                        style.outlineColor || "#000000"
                      )).withAlpha(style.outlineColorAlpha || 1)),
                (this.outline.polyline.material = color),
                (this.outline.polyline.clampToGround =
                  1 == Number(style.heightReference))),
              (this.entity.rectangle.heightReference = Number(
                style.heightReference
              )),
              (this.entity.rectangle.fill = style.fill),
              (this.style = Object.assign(this.style, style)));
          },
        },
        {
          key: "destroy",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              this.entity &&
                (this.viewer.entities.remove(this.entity),
                (this.entity = void 0)),
              this.outline &&
                (this.viewer.entities.remove(this.outline),
                (this.outline = void 0)),
              this.leftupPoint &&
                (this.viewer.entities.remove(this.leftupPoint),
                (this.leftupPoint = void 0)),
              this.rightdownPoint &&
                (this.viewer.entities.remove(this.rightdownPoint),
                (this.rightdownPoint = void 0)),
              (this.positions = []),
              (this.style = void 0),
              (this.modifyPoint = void 0),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "no"),
              this.forbidDrawWorld(!1);
          },
        },
      ]),
      CreateRectangle
    );
  })();
function FlowLineMaterial(opt) {
  (this.defaultColor = new Cesium.Color(0, 0, 0, 0)),
    (opt = opt || {}),
    (this._definitionChanged = new Cesium.Event()),
    (this._color = void 0),
    (this.color = opt.color || this.defaultColor),
    (this._duration = opt.duration || 1e3),
    (this.url = opt.image),
    (this._time = void 0),
    (this.repeat = opt.repeat || new Cesium.Cartesian2(1, 1));
}
function WallMaterial(opt) {
  (this._definitionChanged = new Cesium.Event()),
    (this._color = opt.color),
    (this.duration = opt.duration || 1e3),
    (this._time = new Date().getTime()),
    opt.image || console.log("未传入材料图片！"),
    (this.image = opt.image),
    (this.repeat = opt.repeat || new Cesium.Cartesian2(5, 1)),
    (this.axisY = opt.axisY);
}
function WaveMaterial(opt) {
  (this._definitionChanged = new Cesium.Event()),
    (this._color = void 0),
    (this.defaultColor = Cesium.Color.fromCssColorString("#02ff00")),
    (this.color = Cesium.defaultValue(opt.color, this.defaultColor)),
    (this._duration = opt.duration || 1e3),
    (this._time = void 0);
}
function ScanMaterial(opt) {
  (this.defaultColor = new Cesium.Color(0, 0, 0, 0)),
    (opt = opt || {}),
    (this._definitionChanged = new Cesium.Event()),
    (this._color = void 0),
    (this.color = opt.color || this.defaultColor),
    (this._duration = opt.duration || 1e3),
    (this._time = void 0);
}
function CylinderMaterial(options) {
  (options = Cesium.defaultValue(options, Cesium.defaultValue.EMPTY_OBJECT)),
    (this._definitionChanged = new Cesium.Event()),
    (this._color = void 0),
    (this._colorSubscription = void 0),
    (this.color = Cesium.defaultValue(options.color, Cesium.Color.WHITE)),
    (this._duration = options.duration || 1e3),
    (this.bottom = null == options.bottom || options.bottom),
    (this._time = void 0);
}
(FlowLineMaterial.prototype.getType = function (time) {
  return "FlowLine";
}),
  (FlowLineMaterial.prototype.getValue = function (time, result) {
    return (
      ((result = Cesium.defined(result) ? result : {}).color =
        Cesium.Property.getValueOrClonedDefault(
          this.color,
          time,
          this.defaultColor,
          result.color
        )),
      (result.image = this.url),
      void 0 === this._time && (this._time = new Date().getTime()),
      (result.time = (new Date().getTime() - this._time) / this._duration),
      (result.repeat = this.repeat),
      result
    );
  }),
  (FlowLineMaterial.prototype.equals = function (other) {
    return (
      this === other ||
      (other instanceof FlowLineMaterial &&
        Cesium.Property.equals(this._color, other._color) &&
        this._image._value == other._image._value &&
        this.repeat.equals(other.repeat))
    );
  }),
  (FlowLineMaterial.prototype.isConstant = function () {
    return !1;
  }),
  (FlowLineMaterial.prototype.definitionChanged = function () {
    return this._definitionChanged;
  }),
  Object.defineProperties(FlowLineMaterial.prototype, {
    isConstant: {
      get: function () {
        return !1;
      },
    },
    definitionChanged: {
      get: function () {
        return this._definitionChanged;
      },
    },
    color: Cesium.createPropertyDescriptor("color"),
  }),
  Cesium.Material._materialCache.addMaterial("FlowLine", {
    fabric: {
      type: "FlowLine",
      uniforms: {
        color: new Cesium.Color(1, 0, 0, 1),
        image: "",
        time: 0,
        repeat: new Cesium.Cartesian2(1, 1),
      },
      source:
        "czm_material czm_getMaterial(czm_materialInput materialInput)\n            {\n                czm_material material = czm_getDefaultMaterial(materialInput);\n                vec2 st = repeat * materialInput.st;\n                vec4 colorImage = texture(image, vec2(fract(st.s - time), st.t));\n                if(color.a == 0.0)\n                {\n                    material.alpha = colorImage.a;\n                    material.diffuse = colorImage.rgb; \n                }\n                else\n                {\n                    material.alpha = colorImage.a * color.a;\n                    material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb); \n                }\n                return material;\n            }",
    },
    translucent: function () {
      return !0;
    },
  }),
  (WallMaterial.prototype.getType = function (time) {
    return "WallMaterial";
  }),
  (WallMaterial.prototype.getValue = function (time, result) {
    return (
      ((result = Cesium.defined(result) ? result : {}).color =
        this._color || Cesium.Color.WHITE),
      (result.image = this.image),
      (result.time =
        ((new Date().getTime() - this._time) % this.duration) / this.duration),
      (result.axisY = this.axisY),
      (result.repeat = this.repeat),
      result
    );
  }),
  (WallMaterial.prototype.equals = function (other) {
    return (
      this === other ||
      (other instanceof WallMaterial &&
        Cesium.Property.equals(this._color, other._color) &&
        this._image._value == other._image._value &&
        this.repeat.equals(other.repeat))
    );
  }),
  Object.defineProperties(WallMaterial.prototype, {
    isConstant: {
      get: function () {
        return !1;
      },
    },
    definitionChanged: {
      get: function () {
        return this._definitionChanged;
      },
    },
    color: Cesium.createPropertyDescriptor("color"),
  }),
  Cesium.Material._materialCache.addMaterial("WallMaterial", {
    fabric: {
      type: "WallMaterial",
      uniforms: {
        color: new Cesium.Color(1, 0, 0, 0.5),
        image: "",
        time: 0,
        repeat: new Cesium.Cartesian2(5, 1),
        axisY: !1,
      },
      source:
        "czm_material czm_getMaterial(czm_materialInput materialInput)\n                      {\n                          czm_material material = czm_getDefaultMaterial(materialInput);\n                          vec2 st = repeat * materialInput.st;\n                          vec4 colorImage = texture(image, vec2(fract((axisY?st.s:st.t) - time), st.t));\n                          if(color.a == 0.0)\n                          {\n                              material.alpha = colorImage.a;\n                              material.diffuse = colorImage.rgb; \n                          }\n                          else\n                          {\n                              material.alpha = colorImage.a * color.a;\n                              material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb); \n                          }\n                          // material.emission = colorImage.rgb;\n                          return material;\n                      }",
    },
    translucent: function (material) {
      return !0;
    },
  }),
  (WaveMaterial.prototype.color = function () {
    return Cesium.createPropertyDescriptor("color");
  }),
  (WaveMaterial.prototype.getType = function () {
    return "WaveMaterial";
  }),
  (WaveMaterial.prototype.getValue = function (time, result) {
    return (
      ((result = Cesium.defined(result) ? result : {}).color =
        Cesium.Property.getValueOrClonedDefault(
          this._color,
          time,
          this.color,
          result.color
        )),
      void 0 === this._time && (this._time = new Date().getTime()),
      (result.time = (new Date().getTime() - this._time) / this._duration),
      result
    );
  }),
  (WaveMaterial.prototype.equals = function (other) {
    return (
      this === other ||
      (other instanceof WaveMaterial &&
        Cesium.Property.equals(this._color, other._color))
    );
  }),
  Object.defineProperties(WaveMaterial.prototype, {
    isConstant: {
      get: function () {
        return !1;
      },
    },
    definitionChanged: {
      get: function () {
        return this._definitionChanged;
      },
    },
  }),
  Cesium.Material._materialCache.addMaterial("WaveMaterial", {
    fabric: {
      type: "WaveMaterial",
      uniforms: { color: new Cesium.Color(1, 0, 0, 1), time: 10 },
      source:
        "czm_material czm_getMaterial(czm_materialInput materialInput)\n            {\n                czm_material material = czm_getDefaultMaterial(materialInput);\n                material.diffuse = 1.5 * color.rgb;\n                vec2 st = materialInput.st;\n                float dis = distance(st, vec2(0.5, 0.5));\n                float per = fract(time);\n                if(dis > per * 0.5){\n                    discard;\n                }else {\n                    material.alpha = color.a  * dis / per / 2.0;\n                }\n                return material;\n            }\n        ",
    },
    translucent: function () {
      return !0;
    },
  }),
  (ScanMaterial.prototype.getType = function (time) {
    return "ScanMaterial";
  }),
  (ScanMaterial.prototype.getValue = function (time, result) {
    return (
      ((result = Cesium.defined(result) ? result : {}).color =
        Cesium.Property.getValueOrClonedDefault(
          this.color,
          time,
          this.defaultColor,
          result.color
        )),
      void 0 === this._time && (this._time = new Date().getTime()),
      (result.time = (new Date().getTime() - this._time) / this._duration),
      result
    );
  }),
  (ScanMaterial.prototype.equals = function (other) {
    return (
      this === other ||
      (other instanceof ScanMaterial &&
        Cesium.Property.equals(this._color, other._color))
    );
  }),
  Object.defineProperties(ScanMaterial.prototype, {
    isConstant: {
      get: function () {
        return !1;
      },
    },
    definitionChanged: {
      get: function () {
        return this._definitionChanged;
      },
    },
    color: Cesium.createPropertyDescriptor("color"),
  }),
  Cesium.Material._materialCache.addMaterial("ScanMaterial", {
    fabric: {
      type: "",
      uniforms: {
        color: new Cesium.Color(1, 0, 0, 1),
        time: new Date().getTime(),
        corver: 90,
        speed: 5,
      },
      source:
        "czm_material czm_getMaterial(czm_materialInput materialInput){\n                    czm_material material = czm_getDefaultMaterial(materialInput);\n                    vec2 st = materialInput.st;\n                    st.x = st.x - 0.5;\n                    st.y = st.y - 0.5;\n                    vec2 normalize_st = normalize(st);\n                    float rotateAngle = mod(time * speed,360.0);\n                    vec2 center_y = vec2(1.0,0.0);\n                    center_y.x = cos(rotateAngle);\n                    center_y.y = sin(rotateAngle);\n\n                    vec2 normalize_center_y = normalize(center_y);\n                    // 计算当前纹理坐标和中心点的夹角\n                    float angle_cos_y = dot(normalize_center_y,normalize_st);\n                    angle_cos_y = acos(angle_cos_y);\n                    float angle = degrees(angle_cos_y);\n\n                    vec3 normalize_center_y_vec3 = vec3(normalize_center_y,0.0);\n                    vec3 st_vec3 = vec3(st,0.0);\n                    vec3 cross_value = cross(normalize_center_y_vec3,st_vec3);\n                    if(cross_value.z > 0.0){\n                        angle = angle + 360.0;\n                    }\n\n                    float alpha ;\n                    if(angle > corver){\n                        alpha = 0.0;\n                    }else{\n                        alpha = 1.0 - angle/corver;\n                    }\n\n                    material.diffuse = color.rgb;\n                    material.alpha = alpha;\n                    return material;\n        }",
    },
    translucent: function () {
      return !0;
    },
  }),
  (CylinderMaterial.prototype.getType = function (time) {
    return "cylinderMaterial";
  }),
  (CylinderMaterial.prototype.getValue = function (time, result) {
    return (
      ((result = Cesium.defined(result) ? result : {}).color =
        Cesium.Property.getValueOrClonedDefault(
          this._color,
          time,
          Cesium.Color.WHITE,
          result.color
        )),
      (result.bottom = this.bottom),
      void 0 === this._time && (this._time = new Date().getTime()),
      (result.time = (new Date().getTime() - this._time) / this._duration),
      result
    );
  }),
  (CylinderMaterial.prototype.equals = function (other) {
    return (
      this === other ||
      (other instanceof CylinderMaterial &&
        Property.equals(this._color, other._color))
    );
  }),
  Object.defineProperties(CylinderMaterial.prototype, {
    isConstant: {
      get: function () {
        return !1;
      },
    },
    definitionChanged: {
      get: function () {
        return this._definitionChanged;
      },
    },
    color: Cesium.createPropertyDescriptor("color"),
  }),
  Cesium.Material._materialCache.addMaterial("cylinderMaterial", {
    fabric: {
      type: Cesium.Material.CircleFadeMaterialType,
      uniforms: { color: new Cesium.Color(1, 0, 0, 1), time: 1, bottom: !0 },
      source:
        "czm_material czm_getMaterial(czm_materialInput materialInput)\n\t    {\n            czm_material material = czm_getDefaultMaterial(materialInput);\n            material.diffuse = 1.5 * color.rgb;\n            vec2 st = materialInput.st;\n            float dis = distance(st, vec2(0.5, 0.5));\n            float per = fract(time);\n            if(dis > per * 0.5){\n                //material.alpha = 0.0;\n                discard;\n            }else {\n                material.alpha = color.a  * dis / per ;\n            }\n\n            if(!bottom){\n                vec3 v_normalMC = czm_inverseNormal * materialInput.normalEC;\n                vec3 axis_z = vec3(0.0, 0.0, 1.0);\n                if (dot(axis_z, v_normalMC) > 0.95){\n                    material.alpha = 0.0;\n                }\n            }\n           \n            return material;\n\t    }",
    },
    translucent: function () {
      return !0;
    },
  });
var EllipsoidTrailMaterial = (function () {
    function EllipsoidTrailMaterial(options) {
      _classCallCheck(this, EllipsoidTrailMaterial),
        (this._definitionChanged = new Cesium.Event()),
        (this._color = void 0),
        (this._speed = void 0),
        (this.color = options.color),
        (this.speed = options.speed);
    }
    return (
      _createClass(EllipsoidTrailMaterial, [
        {
          key: "isConstant",
          get: function () {
            return !1;
          },
        },
        {
          key: "definitionChanged",
          get: function () {
            return this._definitionChanged;
          },
        },
        {
          key: "getType",
          value: function (time) {
            return "ellipsoidTrailMaterial";
          },
        },
        {
          key: "getValue",
          value: function (time, result) {
            return (
              ((result = Cesium.defined(result) ? result : {}).color =
                Cesium.Property.getValueOrDefault(
                  this._color,
                  time,
                  Cesium.Color.RED,
                  result.color
                )),
              (result.speed = Cesium.Property.getValueOrDefault(
                this._speed,
                time,
                10,
                result.speed
              )),
              result
            );
          },
        },
        {
          key: "equals",
          value: function (other) {
            return (
              this === other ||
              (other instanceof EllipsoidTrailMaterial &&
                Cesium.Property.equals(this._color, other._color) &&
                Cesium.Property.equals(this._speed, other._speed))
            );
          },
        },
      ]),
      EllipsoidTrailMaterial
    );
  })(),
  material =
    (Object.defineProperties(EllipsoidTrailMaterial.prototype, {
      color: Cesium.createPropertyDescriptor("color"),
      speed: Cesium.createPropertyDescriptor("speed"),
    }),
    Cesium.Material._materialCache.addMaterial("ellipsoidTrailMaterial", {
      fabric: {
        type: "ellipsoidTrailMaterial",
        uniforms: { color: new Cesium.Color(1, 0, 0, 1), speed: 2 },
        source:
          "\n                uniform vec4 color;\n                uniform float speed;\n                czm_material czm_getMaterial(czm_materialInput materialInput){\n                czm_material material = czm_getDefaultMaterial(materialInput);\n                vec2 st = materialInput.st;\n                float time = fract(czm_frameNumber * speed / 1000.0);\n                float alpha = abs(smoothstep(0.5,1.,fract( -st.t - time)));\n                alpha += .1;\n                material.alpha = alpha;\n                material.diffuse = color.rgb;\n                return material;\n            }\n    ",
      },
      translucent: function (material) {
        return !0;
      },
    }),
    {
      LineFlow: FlowLineMaterial,
      Wall: WallMaterial,
      EllipseWave: WaveMaterial,
      EllipseScan: ScanMaterial,
      CylinderScan: CylinderMaterial,
      Elipsoid: EllipsoidTrailMaterial,
    }),
  CreatePolyline = (function () {
    _inherits(CreatePolyline, BasePlot);
    var _super = _createSuper(CreatePolyline);
    function CreatePolyline(viewer, opt) {
      return (
        _classCallCheck(this, CreatePolyline),
        ((viewer = _super.call(this, viewer, opt)).movePush = !1),
        (viewer.type = "polyline"),
        (viewer.maxPointNum = viewer.style.maxPointNum || Number.MAX_VALUE),
        viewer
      );
    }
    return (
      _createClass(CreatePolyline, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              (this.state = "startCreate");
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                var evt = that.getCatesian3FromPX(evt.position, that.viewer, [
                  that.entity,
                ]);
                evt &&
                  (that.movePush &&
                    (that.positions.pop(), (that.movePush = !1)),
                  that.positions.push(evt),
                  ((evt = that.createPoint(evt)).wz =
                    that.positions.length - 1),
                  that.controlPoints.push(evt),
                  that.positions.length == that.maxPointNum &&
                    (that.endCreate(), callback && callback(that.entity)),
                  that.setRightToolState(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                (that.state = "creating"),
                  that.positions.length < 1
                    ? (that.prompt.update(evt.endPosition, "单击开始绘制"),
                      (that.state = "startCreate"),
                      that.setRightToolState(!1))
                    : (that.prompt.update(
                        evt.endPosition,
                        "右键取消上一步，双击结束"
                      ),
                      (evt = that.getCatesian3FromPX(
                        evt.endPosition,
                        that.viewer,
                        [that.entity]
                      )) &&
                        (that.movePush
                          ? (that.positions[that.positions.length - 1] = evt)
                          : (that.positions.push(evt), (that.movePush = !0)),
                        2 != that.positions.length ||
                          Cesium.defined(that.entity) ||
                          (that.entity = that.createPolyline())));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.handler.setInputAction(function (evt) {
                that.entity &&
                  (that.positions.splice(that.positions.length - 2, 1),
                  that.viewer.entities.remove(that.controlPoints.pop()),
                  1 == that.positions.length &&
                    (that.entity &&
                      (that.viewer.entities.remove(that.entity),
                      (that.entity = void 0)),
                    that.prompt.update(evt.endPosition, "单击开始绘制"),
                    (that.movePush = !1),
                    (that.positions = [])));
              }, Cesium.ScreenSpaceEventType.RIGHT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.entity &&
                  (that.endCreate(), callback && callback(that.entity));
              }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
          },
        },
        {
          key: "endCreate",
          value: function () {
            (this.state = "endCreate"),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.positions.pop(),
              this.viewer.entities.remove(this.controlPoints.pop()),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.viewer.trackedEntity = void 0),
              this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "creating" == this.state
              ? this.positions.length <= 2 && 1 == this.movePush
                ? this.destroy()
                : this.endCreate()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "createByPositions",
          value: function (lnglatArr, callback) {
            if (lnglatArr && !(lnglatArr.length < 1)) {
              this.state = "startCreate";
              var positions =
                lnglatArr[0] instanceof Cesium.Cartesian3
                  ? lnglatArr
                  : util$1.lnglatsToCartesians(lnglatArr);
              if (positions) {
                (this.entity = this.createPolyline(this.style)),
                  (this.positions = positions),
                  callback && callback(this.entity);
                for (var i = 0; i < positions.length; i++) {
                  var newP = positions[i],
                    newP = this.createPoint(newP);
                  this.style.clampToGround && (newP.point.heightReference = 1),
                    (newP.wz = this.controlPoints.length),
                    this.controlPoints.push(newP);
                }
                this.state = "endCreate";
              }
            }
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            var material;
            style &&
              ((material = this.getMaterial(style.material, style)),
              (this.entity.polyline.material = material),
              (this.entity.polyline.clampToGround = Boolean(
                style.clampToGround
              )),
              style.width && (this.entity.polyline.width = style.width || 3),
              (this.style = Object.assign(this.style, style)));
          },
        },
        {
          key: "getStyle",
          value: function () {
            var obj, polyline, color;
            if (this.entity)
              return (
                (obj = {}),
                (polyline = this.entity.polyline),
                null != this.style.animateType &&
                  ((obj.animateType = this.style.animateType),
                  (obj.image = this.style.image),
                  (obj.duration = this.style.duration)),
                polyline.material instanceof Cesium.ColorMaterialProperty
                  ? (obj.material = "common")
                  : ((obj.material = "flowline"),
                    (obj.duration = polyline.material._duration),
                    (obj.image = polyline.material.url)),
                (color = polyline.material.color.getValue()),
                (obj.colorAlpha = color.alpha),
                (obj.color = new Cesium.Color(
                  color.red,
                  color.green,
                  color.blue,
                  1
                ).toCssHexString()),
                (obj.width = polyline.width._value),
                (color =
                  !!polyline.clampToGround &&
                  polyline.clampToGround.getValue()),
                (obj.clampToGround = Boolean(color)),
                obj
              );
          },
        },
        {
          key: "createPolyline",
          value: function () {
            var that = this,
              polyline = this.viewer.entities.add({
                polyline: {
                  positions: new Cesium.CallbackProperty(function () {
                    return that.positions;
                  }, !1),
                  show: !0,
                  material: this.getMaterial(
                    this.style.animateType,
                    this.style
                  ),
                  width: this.style.width || 3,
                  clampToGround: this.style.clampToGround,
                },
              });
            return (polyline.objId = this.objId), polyline;
          },
        },
        {
          key: "getMaterial",
          value: function (animateType, style) {
            var material$1 = void 0,
              color = (style = style || {}).color || Cesium.Color.WHITE;
            if (
              ((color = (color =
                color instanceof Cesium.Color
                  ? color
                  : Cesium.Color.fromCssColorString(style.color)).withAlpha(
                style.colorAlpha || 1
              )),
              "flowline" == animateType)
            ) {
              if (!style.image)
                return console.log("动态材质，缺少纹理图片"), color;
              material$1 = new material.LineFlow({
                color: color,
                image: style.image,
                duration: style.duration || 5e3,
              });
            } else if ("flyline" == animateType) {
              if (!style.image)
                return console.log("动态材质，缺少纹理图片"), color;
              material$1 = new material.LineFlow({
                color: color,
                duration: style.duration || 3e3,
                image: style.image,
                repeat: new Cesium.Cartesian2(1, 1),
              });
            } else material$1 = color;
            return material$1;
          },
        },
      ]),
      CreatePolyline
    );
  })(),
  ArrowUtil = (function () {
    function ArrowUtil(opt) {
      _classCallCheck(this, ArrowUtil),
        (this.FITTING_COUNT = 100),
        (this.HALF_PI = Math.PI / 2),
        (this.ZERO_TOLERANCE = 1e-4),
        (this.TWO_PI = 2 * Math.PI),
        (this.headHeightFactor = opt.headHeightFactor),
        (this.headWidthFactor = opt.headWidthFactor),
        (this.neckHeightFactor = opt.neckHeightFactor),
        (this.neckWidthFactor = opt.neckWidthFactor),
        (this.headTailFactor = opt.headTailFactor),
        (this.tailWidthFactor = opt.tailWidthFactor),
        (this.swallowTailFactor = opt.swallowTailFactor);
    }
    return (
      _createClass(ArrowUtil, [
        {
          key: "cartesian32WeMercator",
          value: function (position) {
            if (position)
              return (
                (position = this.cartesianToLnglat(position)),
                this.lnglat2WeMercator(position)
              );
          },
        },
        {
          key: "webMercator2Cartesian3",
          value: function (arg) {
            if (arg)
              return (
                (arg = this.webMercator2Lnglat(arg)),
                Cesium.Cartesian3.fromDegrees(arg[0], arg[1])
              );
          },
        },
        {
          key: "webMercator2Lnglat",
          value: function (points) {
            var x;
            if (points)
              return (
                (x = (points[0] / 20037508.34) * 180),
                (points = (points[1] / 20037508.34) * 180),
                [
                  x,
                  (points =
                    (180 / Math.PI) *
                    (2 * Math.atan(Math.exp((points * Math.PI) / 180)) -
                      Math.PI / 2)),
                ]
              );
          },
        },
        {
          key: "lnglat2WeMercator",
          value: function (lnglat) {
            if (lnglat)
              return [
                (20037508.34 * lnglat[0]) / 180,
                (20037508.34 *
                  (Math.log(Math.tan(((90 + lnglat[1]) * Math.PI) / 360)) /
                    (Math.PI / 180))) /
                  180,
              ];
          },
        },
        {
          key: "getThirdPoint",
          value: function (startPnt, endPnt, angle, distance, clockWise) {
            (startPnt = this.getAzimuth(startPnt, endPnt)),
              (clockWise = clockWise ? startPnt + angle : startPnt - angle),
              (startPnt = distance * Math.cos(clockWise)),
              (angle = distance * Math.sin(clockWise));
            return [endPnt[0] + startPnt, endPnt[1] + angle];
          },
        },
        {
          key: "getAzimuth",
          value: function (startPoint, endPoint) {
            var azimuth = void 0,
              angle = Math.asin(
                Math.abs(endPoint[1] - startPoint[1]) /
                  this.MathDistance(startPoint, endPoint)
              );
            return (
              endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]
                ? (azimuth = angle + Math.PI)
                : endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]
                ? (azimuth = 2 * Math.PI - angle)
                : endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]
                ? (azimuth = angle)
                : endPoint[1] < startPoint[1] &&
                  endPoint[0] >= startPoint[0] &&
                  (azimuth = Math.PI - angle),
              azimuth
            );
          },
        },
        {
          key: "MathDistance",
          value: function (pnt1, pnt2) {
            var a = Math.pow(pnt1[0] - pnt2[0], 2),
              pnt1 = Math.pow(pnt1[1] - pnt2[1], 2);
            return Math.sqrt(a + pnt1) || 0.001;
          },
        },
        {
          key: "isClockWise",
          value: function (pnt1, pnt2, pnt3) {
            return (
              (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) >
              (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0])
            );
          },
        },
        {
          key: "getNormal",
          value: function (pnt1, pnt2, pnt3) {
            var dX1 = pnt1[0] - pnt2[0],
              pnt1 = pnt1[1] - pnt2[1],
              d1 = Math.sqrt(dX1 * dX1 + pnt1 * pnt1),
              d1 = ((dX1 /= d1), (pnt1 /= d1), pnt3[0] - pnt2[0]),
              pnt3 = pnt3[1] - pnt2[1],
              pnt2 = Math.sqrt(d1 * d1 + pnt3 * pnt3);
            return [dX1 + (d1 /= pnt2), pnt1 + (pnt3 /= pnt2)];
          },
        },
        {
          key: "getArcPoints",
          value: function (center, radius, startAngle, endAngle) {
            for (
              var pnts = [],
                angleDiff =
                  (angleDiff = endAngle - startAngle) < 0
                    ? angleDiff + 2 * Math.PI
                    : angleDiff,
                i = 0;
              i <= 100;
              i++
            ) {
              var angle = startAngle + (angleDiff * i) / 100,
                x = center[0] + radius * Math.cos(angle),
                angle = center[1] + radius * Math.sin(angle);
              pnts.push([x, angle]);
            }
            return pnts;
          },
        },
        {
          key: "getBaseLength",
          value: function (points) {
            return Math.pow(this.wholeDistance(points), 0.99);
          },
        },
        {
          key: "wholeDistance",
          value: function (points) {
            var distance = 0,
              that = this;
            return (
              points &&
                Array.isArray(points) &&
                0 < points.length &&
                points.forEach(function (item, index) {
                  index < points.length - 1 &&
                    (distance += that.MathDistance(item, points[index + 1]));
                }),
              distance
            );
          },
        },
        {
          key: "getArrowHeadPoints",
          value: function (points, tailLeft, tailRight) {
            (this.DGIndex = points.length), (this.points = points);
            var headHeight = this.getBaseLength(points) * this.headHeightFactor,
              headPnt = points[points.length - 1],
              len = this.MathDistance(headPnt, points[points.length - 2]),
              tailLeft = this.MathDistance(tailLeft, tailRight),
              tailRight =
                (headHeight =
                  headHeight > tailLeft * this.headTailFactor
                    ? tailLeft * this.headTailFactor
                    : headHeight) * this.headWidthFactor,
              tailLeft = headHeight * this.neckWidthFactor,
              len =
                (headHeight = len < headHeight ? len : headHeight) *
                this.neckHeightFactor,
              headHeight = this.getThirdPoint(
                points[points.length - 2],
                headPnt,
                0,
                headHeight,
                !0
              ),
              points = this.getThirdPoint(
                points[points.length - 2],
                headPnt,
                0,
                len,
                !0
              ),
              len = this.getThirdPoint(
                headPnt,
                headHeight,
                Math.PI / 2,
                tailRight,
                !1
              ),
              headHeight = this.getThirdPoint(
                headPnt,
                headHeight,
                Math.PI / 2,
                tailRight,
                !0
              );
            return [
              this.getThirdPoint(headPnt, points, Math.PI / 2, tailLeft, !1),
              len,
              headPnt,
              headHeight,
              this.getThirdPoint(headPnt, points, Math.PI / 2, tailLeft, !0),
            ];
          },
        },
        {
          key: "getArrowHeadPointsNoLR",
          value: function (points) {
            var headHeight = this.getBaseLength(points) * this.headHeightFactor,
              headPnt = points[points.length - 1],
              headWidth = headHeight * this.headWidthFactor,
              neckWidth = headHeight * this.neckWidthFactor,
              neckHeight = headHeight * this.neckHeightFactor,
              headHeight = this.getThirdPoint(
                points[points.length - 2],
                headPnt,
                0,
                headHeight,
                !0
              ),
              points = this.getThirdPoint(
                points[points.length - 2],
                headPnt,
                0,
                neckHeight,
                !0
              ),
              neckHeight = this.getThirdPoint(
                headPnt,
                headHeight,
                Math.PI / 2,
                headWidth,
                !1
              ),
              headHeight = this.getThirdPoint(
                headPnt,
                headHeight,
                Math.PI / 2,
                headWidth,
                !0
              );
            return [
              this.getThirdPoint(headPnt, points, Math.PI / 2, neckWidth, !1),
              neckHeight,
              headPnt,
              headHeight,
              this.getThirdPoint(headPnt, points, Math.PI / 2, neckWidth, !0),
            ];
          },
        },
        {
          key: "getTailPoints",
          value: function (points) {
            var tailWidth = this.getBaseLength(points) * this.tailWidthFactor;
            return [
              this.getThirdPoint(
                points[1],
                points[0],
                Math.PI / 2,
                tailWidth,
                !1
              ),
              this.getThirdPoint(
                points[1],
                points[0],
                Math.PI / 2,
                tailWidth,
                !0
              ),
            ];
          },
        },
        {
          key: "getArrowBodyPoints",
          value: function (points, neckLeft, neckRight, tailWidthFactor) {
            for (
              var allLen = this.wholeDistance(points),
                tailWidth = this.getBaseLength(points) * tailWidthFactor,
                widthDif =
                  (tailWidth - this.MathDistance(neckLeft, neckRight)) / 2,
                tempLen = 0,
                leftBodyPnts = [],
                rightBodyPnts = [],
                i = 1;
              i < points.length - 1;
              i++
            ) {
              var angle =
                  this.getAngleOfThreePoints(
                    points[i - 1],
                    points[i],
                    points[i + 1]
                  ) / 2,
                w =
                  (tailWidth / 2 -
                    ((tempLen += this.MathDistance(points[i - 1], points[i])) /
                      allLen) *
                      widthDif) /
                  Math.sin(angle),
                left = this.getThirdPoint(
                  points[i - 1],
                  points[i],
                  Math.PI - angle,
                  w,
                  !0
                ),
                angle = this.getThirdPoint(
                  points[i - 1],
                  points[i],
                  angle,
                  w,
                  !1
                );
              leftBodyPnts.push(left), rightBodyPnts.push(angle);
            }
            return leftBodyPnts.concat(rightBodyPnts);
          },
        },
        {
          key: "getAngleOfThreePoints",
          value: function (pntA, pntB, pntC) {
            pntA = this.getAzimuth(pntB, pntA) - this.getAzimuth(pntB, pntC);
            return pntA < 0 ? pntA + 2 * Math.PI : pntA;
          },
        },
        {
          key: "getQBSplinePoints",
          value: function (points) {
            if (points.length <= 2) return points;
            var bSplinePoints = [],
              m = points.length - 2 - 1;
            bSplinePoints.push(points[0]);
            for (var i = 0; i <= m; i++)
              for (var t = 0; t <= 1; t += 0.05) {
                for (var x = 0, y = 0, k = 0; k <= 2; k++) {
                  var factor = this.getQuadricBSplineFactor(k, t);
                  (x += factor * points[i + k][0]),
                    (y += factor * points[i + k][1]);
                }
                bSplinePoints.push([x, y]);
              }
            return bSplinePoints.push(points[points.length - 1]), bSplinePoints;
          },
        },
        {
          key: "getQuadricBSplineFactor",
          value: function (k, t) {
            var res = 0;
            return (
              0 === k
                ? (res = Math.pow(t - 1, 2) / 2)
                : 1 === k
                ? (res = (-2 * Math.pow(t, 2) + 2 * t + 1) / 2)
                : 2 === k && (res = Math.pow(t, 2) / 2),
              res
            );
          },
        },
        {
          key: "Mid",
          value: function (point1, point2) {
            return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
          },
        },
        {
          key: "getCircleCenterOfThreePoints",
          value: function (point1, point2, point3) {
            var pntA = [
                (point1[0] + point2[0]) / 2,
                (point1[1] + point2[1]) / 2,
              ],
              point2 = [
                pntA[0] - point1[1] + point2[1],
                pntA[1] + point1[0] - point2[0],
              ],
              pntC = [(point1[0] + point3[0]) / 2, (point1[1] + point3[1]) / 2],
              point1 = [
                pntC[0] - point1[1] + point3[1],
                pntC[1] + point1[0] - point3[0],
              ];
            return this.getIntersectPoint(pntA, point2, pntC, point1);
          },
        },
        {
          key: "getIntersectPoint",
          value: function (pntA, pntB, pntC, pntD) {
            return pntA[1] === pntB[1]
              ? [
                  ((pntD[0] - pntC[0]) / (pntD[1] - pntC[1])) *
                    (pntA[1] - pntC[1]) +
                    pntC[0],
                  pntA[1],
                ]
              : pntC[1] === pntD[1]
              ? [
                  ((pntB[0] - pntA[0]) / (pntB[1] - pntA[1])) *
                    (pntC[1] - pntA[1]) +
                    pntA[0],
                  pntC[1],
                ]
              : ((pntB = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1])),
                (pntD = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1])),
                [
                  pntB *
                    (pntC =
                      (pntB * pntA[1] - pntA[0] - pntD * pntC[1] + pntC[0]) /
                      (pntB - pntD)) -
                    pntB * pntA[1] +
                    pntA[0],
                  pntC,
                ]);
          },
        },
        {
          key: "getBezierPoints",
          value: function (points) {
            if (points.length <= 2) return points;
            for (
              var bezierPoints = [], n = points.length - 1, t = 0;
              t <= 1;
              t += 0.01
            ) {
              for (var x = 0, y = 0, index = 0; index <= n; index++) {
                var factor = this.getBinomialFactor(n, index),
                  a = Math.pow(t, index),
                  b = Math.pow(1 - t, n - index);
                (x += factor * a * b * points[index][0]),
                  (y += factor * a * b * points[index][1]);
              }
              bezierPoints.push([x, y]);
            }
            return bezierPoints.push(points[n]), bezierPoints;
          },
        },
        {
          key: "getFactorial",
          value: function (n) {
            var result = 1;
            switch (n) {
              case n <= 1:
                result = 1;
                break;
              case 2 === n:
                result = 2;
                break;
              case 3 === n:
                result = 6;
                break;
              case 24 === n:
                result = 24;
                break;
              case 5 === n:
                result = 120;
                break;
              default:
                for (var i = 1; i <= n; i++) result *= i;
            }
            return result;
          },
        },
        {
          key: "getBinomialFactor",
          value: function (n, index) {
            return (
              this.getFactorial(n) /
              (this.getFactorial(index) * this.getFactorial(n - index))
            );
          },
        },
        {
          key: "cartesianToLnglat",
          value: function (cartesian) {
            var lat;
            if (cartesian)
              return (
                (cartesian = Cesium.Cartographic.fromCartesian(cartesian)),
                (lat = Cesium.Math.toDegrees(cartesian.latitude)),
                [
                  Cesium.Math.toDegrees(cartesian.longitude),
                  lat,
                  cartesian.height,
                ]
              );
          },
        },
        {
          key: "getCurvePoints",
          value: function (t, controlPoints) {
            for (
              var pnt1 = void 0,
                pnt2 = void 0,
                normals = [this.getLeftMostControlPoint(controlPoints, t)],
                points = [],
                i = 0;
              i < controlPoints.length - 2;
              i++
            )
              var _ref2 = [
                  controlPoints[i],
                  controlPoints[i + 1],
                  controlPoints[i + 2],
                ],
                pnt1 = _ref2[0],
                pnt2 = _ref2[1],
                _ref2 = this.getBisectorNormals(t, pnt1, pnt2, _ref2[2]),
                normals = normals.concat(_ref2);
            var rightControl = this.getRightMostControlPoint(controlPoints, t);
            rightControl && normals.push(rightControl);
            for (var _i = 0; _i < controlPoints.length - 1; _i++) {
              (pnt1 = controlPoints[_i]),
                (pnt2 = controlPoints[_i + 1]),
                points.push(pnt1);
              for (var _t = 0; _t < this.FITTING_COUNT; _t++) {
                var pnt = this.getCubicValue(
                  _t / this.FITTING_COUNT,
                  pnt1,
                  normals[2 * _i],
                  normals[2 * _i + 1],
                  pnt2
                );
                points.push(pnt);
              }
              points.push(pnt2);
            }
            return points;
          },
        },
        {
          key: "getCubicValue",
          value: function (t, startPnt, cPnt1, cPnt2, endPnt) {
            var tp = 1 - (t = Math.max(Math.min(t, 1), 0)),
              t2 = t * t,
              t3 = t2 * t,
              tp2 = tp * tp,
              tp3 = tp2 * tp;
            return [
              tp3 * startPnt[0] +
                3 * tp2 * t * cPnt1[0] +
                3 * tp * t2 * cPnt2[0] +
                t3 * endPnt[0],
              tp3 * startPnt[1] +
                3 * tp2 * t * cPnt1[1] +
                3 * tp * t2 * cPnt2[1] +
                t3 * endPnt[1],
            ];
          },
        },
        {
          key: "getLeftMostControlPoint",
          value: function (controlPoints, t) {
            var pY,
              n,
              pX,
              dX,
              controlPoints = [
                controlPoints[0],
                controlPoints[1],
                controlPoints[2],
                null,
                null,
              ],
              pnt1 = controlPoints[0],
              pnt2 = controlPoints[1],
              pnt3 = controlPoints[2],
              controlX = controlPoints[3],
              controlPoints = controlPoints[4],
              normalRight = this.getBisectorNormals(0, pnt1, pnt2, pnt3)[0],
              pnt3 = this.getNormal(pnt1, pnt2, pnt3);
            return (
              (controlPoints =
                Math.sqrt(pnt3[0] * pnt3[0] + pnt3[1] * pnt3[1]) >
                this.ZERO_TOLERANCE
                  ? ((pnt3 = this.Mid(pnt1, pnt2)),
                    (pX = pnt1[0] - pnt3[0]),
                    (pY = pnt1[1] - pnt3[1]),
                    (n = 2 / this.MathDistance(pnt1, pnt2)),
                    (dX = normalRight[0] - pnt3[0]),
                    (normalRight = normalRight[1] - pnt3[1]),
                    (controlX =
                      pnt3[0] +
                      ((pY = -n * pY) * pY - (n = n * pX) * n) * dX +
                      (pX = 2 * pY * n) * normalRight),
                    pnt3[1] + pX * dX + (n * n - pY * pY) * normalRight)
                  : ((controlX = pnt1[0] + t * (pnt2[0] - pnt1[0])),
                    pnt1[1] + t * (pnt2[1] - pnt1[1]))),
              [controlX, controlPoints]
            );
          },
        },
        {
          key: "getBisectorNormals",
          value: function (t, pnt1, pnt2, pnt3) {
            var normal = this.getNormal(pnt1, pnt2, pnt3),
              bisectorNormalRight = void 0,
              bisectorNormalLeft = void 0,
              dt = void 0,
              dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]),
              uX = normal[0] / dist,
              normal = normal[1] / dist,
              d1 = this.MathDistance(pnt1, pnt2),
              d2 = this.MathDistance(pnt2, pnt3),
              bisectorNormalLeft =
                dist > this.ZERO_TOLERANCE
                  ? this.isClockWise(pnt1, pnt2, pnt3)
                    ? ((bisectorNormalRight = [
                        pnt2[0] - (dt = t * d1) * normal,
                        pnt2[1] + dt * uX,
                      ]),
                      [pnt2[0] + (dt = t * d2) * normal, pnt2[1] - dt * uX])
                    : ((bisectorNormalRight = [
                        pnt2[0] + (dt = t * d1) * normal,
                        pnt2[1] - dt * uX,
                      ]),
                      [pnt2[0] - (dt = t * d2) * normal, pnt2[1] + dt * uX])
                  : ((bisectorNormalRight = [
                      pnt2[0] + t * (pnt1[0] - pnt2[0]),
                      pnt2[1] + t * (pnt1[1] - pnt2[1]),
                    ]),
                    [
                      pnt2[0] + t * (pnt3[0] - pnt2[0]),
                      pnt2[1] + t * (pnt3[1] - pnt2[1]),
                    ]);
            return [bisectorNormalRight, bisectorNormalLeft];
          },
        },
        {
          key: "getRightMostControlPoint",
          value: function (controlPoints, t) {
            var pY,
              n,
              pX,
              dX,
              count = controlPoints.length,
              pnt1 = controlPoints[count - 3],
              pnt2 = controlPoints[count - 2],
              controlPoints = controlPoints[count - 1],
              count = this.getBisectorNormals(0, pnt1, pnt2, controlPoints)[1],
              pnt1 = this.getNormal(pnt1, pnt2, controlPoints),
              controlX = void 0,
              controlY = void 0;
            return (
              (controlY =
                Math.sqrt(pnt1[0] * pnt1[0] + pnt1[1] * pnt1[1]) >
                this.ZERO_TOLERANCE
                  ? ((pnt1 = this.Mid(pnt2, controlPoints)),
                    (pX = controlPoints[0] - pnt1[0]),
                    (pY = controlPoints[1] - pnt1[1]),
                    (n = 2 / this.MathDistance(pnt2, controlPoints)),
                    (dX = count[0] - pnt1[0]),
                    (count = count[1] - pnt1[1]),
                    (controlX =
                      pnt1[0] +
                      ((pY = -n * pY) * pY - (n = n * pX) * n) * dX +
                      (pX = 2 * pY * n) * count),
                    pnt1[1] + pX * dX + (n * n - pY * pY) * count)
                  : ((controlX =
                      controlPoints[0] + t * (pnt2[0] - controlPoints[0])),
                    controlPoints[1] + t * (pnt2[1] - controlPoints[1]))),
              [controlX, controlY]
            );
          },
        },
      ]),
      ArrowUtil
    );
  })(),
  AttackArrow = (function () {
    function AttackArrow(opt) {
      _classCallCheck(this, AttackArrow),
        (this.type = "AttackArrow"),
        ((opt = opt || {}).headHeightFactor = opt.headHeightFactor || 0.18),
        (opt.headWidthFactor = opt.headWidthFactor || 0.3),
        (opt.neckHeightFactor = opt.neckHeightFactor || 0.85),
        (opt.neckWidthFactor = opt.neckWidthFactor || 0.15),
        (opt.headTailFactor = opt.headTailFactor || 0.8),
        (this.positions = void 0),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(AttackArrow, [
        {
          key: "startCompute",
          value: function (positions) {
            if (positions) {
              this.positions = positions;
              for (var pnts = [], i = 0; i < positions.length; i++) {
                var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
                pnts.push(newP);
              }
              var _ref = [pnts[0], pnts[1]],
                tailLeft = _ref[0],
                _ref = _ref[1];
              this.plotUtil.isClockWise(pnts[0], pnts[1], pnts[2]) &&
                ((tailLeft = pnts[1]), (_ref = pnts[0]));
              var bonePnts = [this.plotUtil.Mid(tailLeft, _ref)].concat(
                  pnts.slice(2)
                ),
                headPnts = this.plotUtil.getArrowHeadPoints(
                  bonePnts,
                  tailLeft,
                  _ref
                );
              if (!headPnts || 0 == headPnts.length)
                return (
                  console.warn("计算面数据有误，不计算，返回传入坐标数组！"),
                  positions
                );
              for (
                var _ref2 = [headPnts[0], headPnts[4]],
                  neckLeft = _ref2[0],
                  _ref2 = _ref2[1],
                  tailWidthFactor =
                    this.plotUtil.MathDistance(tailLeft, _ref) /
                    this.plotUtil.getBaseLength(bonePnts),
                  bonePnts = this.plotUtil.getArrowBodyPoints(
                    bonePnts,
                    neckLeft,
                    _ref2,
                    tailWidthFactor
                  ),
                  tailWidthFactor = bonePnts.length,
                  tailLeft = [tailLeft].concat(
                    bonePnts.slice(0, tailWidthFactor / 2)
                  ),
                  neckLeft =
                    (tailLeft.push(neckLeft),
                    [_ref].concat(
                      bonePnts.slice(tailWidthFactor / 2, tailWidthFactor)
                    )),
                  pList =
                    (neckLeft.push(_ref2),
                    (tailLeft = this.plotUtil.getQBSplinePoints(tailLeft)),
                    (neckLeft = this.plotUtil.getQBSplinePoints(neckLeft)),
                    tailLeft.concat(headPnts, neckLeft.reverse())),
                  returnArr = [],
                  k = 0;
                k < pList.length;
                k++
              ) {
                var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
                returnArr.push(posi);
              }
              return returnArr;
            }
          },
        },
      ]),
      AttackArrow
    );
  })(),
  AttackArrowPW = (function () {
    function AttackArrowPW(arg) {
      _classCallCheck(this, AttackArrowPW);
      var opt = {};
      (opt.headHeightFactor = (arg = arg || {}).headHeightFactor || 0.18),
        (opt.headWidthFactor = arg.headWidthFactor || 0.3),
        (opt.neckHeightFactor = arg.neckHeightFactor || 0.85),
        (opt.neckWidthFactor = arg.neckWidthFactor || 0.15),
        (opt.tailWidthFactor = this.tailWidthFactor =
          arg.tailWidthFactor || 0.1),
        (this.positions = void 0),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(AttackArrowPW, [
        {
          key: "startCompute",
          value: function (positions) {
            if (positions) {
              this.positions = positions;
              for (var pnts = [], i = 0; i < positions.length; i++) {
                var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
                pnts.push(newP);
              }
              for (
                var tailPnts = this.plotUtil.getTailPoints(pnts),
                  headPnts = this.plotUtil.getArrowHeadPoints(
                    pnts,
                    tailPnts[0],
                    tailPnts[1]
                  ),
                  neckLeft = headPnts[0],
                  neckRight = headPnts[4],
                  bodyPnts = this.plotUtil.getArrowBodyPoints(
                    pnts,
                    neckLeft,
                    neckRight,
                    this.tailWidthFactor
                  ),
                  _count = bodyPnts.length,
                  leftPnts = [tailPnts[0]].concat(
                    bodyPnts.slice(0, _count / 2)
                  ),
                  neckLeft =
                    (leftPnts.push(neckLeft),
                    [tailPnts[1]].concat(bodyPnts.slice(_count / 2, _count))),
                  pList =
                    (neckLeft.push(neckRight),
                    (leftPnts = this.plotUtil.getQBSplinePoints(leftPnts)),
                    (neckLeft = this.plotUtil.getQBSplinePoints(neckLeft)),
                    leftPnts.concat(headPnts, neckLeft.reverse())),
                  returnArr = [],
                  k = 0;
                k < pList.length;
                k++
              ) {
                var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
                returnArr.push(posi);
              }
              return returnArr;
            }
          },
        },
      ]),
      AttackArrowPW
    );
  })(),
  AttackArrowYW = (function () {
    function AttackArrowYW(arg) {
      _classCallCheck(this, AttackArrowYW);
      var opt = {};
      (opt.headHeightFactor = (arg = arg || {}).headHeightFactor || 0.18),
        (opt.headWidthFactor = arg.headWidthFactor || 0.3),
        (opt.neckHeightFactor = arg.neckHeightFactor || 0.85),
        (opt.neckWidthFactor = arg.neckWidthFactor || 0.15),
        (opt.tailWidthFactor = this.tailWidthFactor =
          arg.tailWidthFactor || 0.1),
        (opt.headTailFactor = arg.headTailFactor || 0.8),
        (opt.swallowTailFactor = this.swallowTailFactor =
          arg.swallowTailFactor || 1),
        (this.positions = void 0),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(AttackArrowYW, [
        {
          key: "startCompute",
          value: function (positions) {
            if (positions) {
              this.positions = positions;
              for (var pnts = [], i = 0; i < positions.length; i++) {
                var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
                pnts.push(newP);
              }
              var _ref = [pnts[0], pnts[1]],
                tailLeft = _ref[0],
                _ref = _ref[1];
              this.plotUtil.isClockWise(pnts[0], pnts[1], pnts[2]) &&
                ((tailLeft = pnts[1]), (_ref = pnts[0]));
              for (
                var bonePnts = [this.plotUtil.Mid(tailLeft, _ref)].concat(
                    pnts.slice(2)
                  ),
                  headPnts = this.plotUtil.getArrowHeadPoints(
                    bonePnts,
                    tailLeft,
                    _ref
                  ),
                  _ref2 = [headPnts[0], headPnts[4]],
                  neckLeft = _ref2[0],
                  _ref2 = _ref2[1],
                  tailWidth = this.plotUtil.MathDistance(tailLeft, _ref),
                  allLen = this.plotUtil.getBaseLength(bonePnts),
                  len = allLen * this.tailWidthFactor * this.swallowTailFactor,
                  len = this.plotUtil.getThirdPoint(
                    bonePnts[1],
                    bonePnts[0],
                    0,
                    len,
                    !0
                  ),
                  bonePnts = this.plotUtil.getArrowBodyPoints(
                    bonePnts,
                    neckLeft,
                    _ref2,
                    tailWidth / allLen
                  ),
                  tailWidth = bonePnts.length,
                  allLen = [tailLeft].concat(bonePnts.slice(0, tailWidth / 2)),
                  tailLeft =
                    (allLen.push(neckLeft),
                    [_ref].concat(bonePnts.slice(tailWidth / 2, tailWidth))),
                  pList =
                    (tailLeft.push(_ref2),
                    (allLen = this.plotUtil.getQBSplinePoints(allLen)),
                    (tailLeft = this.plotUtil.getQBSplinePoints(tailLeft)),
                    allLen.concat(headPnts, tailLeft.reverse(), [
                      len,
                      allLen[0],
                    ])),
                  returnArr = [],
                  k = 0;
                k < pList.length;
                k++
              ) {
                var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
                returnArr.push(posi);
              }
              return returnArr;
            }
          },
        },
      ]),
      AttackArrowYW
    );
  })(),
  CloseCurve = (function () {
    function CloseCurve(arg) {
      _classCallCheck(this, CloseCurve);
      (this.positions = void 0), (this.plotUtil = new ArrowUtil({}));
    }
    return (
      _createClass(CloseCurve, [
        {
          key: "startCompute",
          value: function (positions) {
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            pnts.push(pnts[0], pnts[1]);
            for (
              var normals = [], pList = [], _i2 = 0;
              _i2 < pnts.length - 2;
              _i2++
            )
              var normalPoints = this.plotUtil.getBisectorNormals(
                  0.3,
                  pnts[_i2],
                  pnts[_i2 + 1],
                  pnts[_i2 + 2]
                ),
                normals = normals.concat(normalPoints);
            var count = normals.length;
            normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
            for (var _i = 0; _i < pnts.length - 2; _i++) {
              var pnt1 = pnts[_i],
                pnt2 = pnts[_i + 1];
              pList.push(pnt1);
              for (var t = 0; t <= 100; t++) {
                var pnt = this.plotUtil.getCubicValue(
                  t / 100,
                  pnt1,
                  normals[2 * _i],
                  normals[2 * _i + 1],
                  pnt2
                );
                pList.push(pnt);
              }
              pList.push(pnt2);
            }
            for (var returnArr = [], k = 0; k < pList.length; k++) {
              var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      CloseCurve
    );
  })(),
  Curve = (function () {
    function Curve(arg) {
      _classCallCheck(this, Curve);
      (this.typeName = "Curve"),
        (this.plotUtil = new ArrowUtil({})),
        (this.t = 0.3);
    }
    return (
      _createClass(Curve, [
        {
          key: "startCompute",
          value: function (positions) {
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            var pList = [];
            if (pnts.length < 2) return !1;
            for (
              var pList =
                  2 === pnts.length
                    ? pnts
                    : this.plotUtil.getCurvePoints(this.t, pnts),
                returnArr = [],
                k = 0;
              k < pList.length;
              k++
            ) {
              var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      Curve
    );
  })(),
  CurveFlag = (function () {
    function CurveFlag(arg) {
      _classCallCheck(this, CurveFlag);
      (this.typeName = "CurveFlag"), (this.plotUtil = new ArrowUtil({}));
    }
    return (
      _createClass(CurveFlag, [
        {
          key: "startCompute",
          value: function (positions) {
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            for (
              var point3,
                point4,
                point5,
                point6,
                point7,
                point8,
                point9,
                point10,
                endPoint,
                startPoint,
                point2,
                pList = [],
                returnArr =
                  (1 < pnts.length &&
                    ((startPoint = pnts[0]),
                    (point2 = [
                      ((endPoint = pnts[pnts.length - 1])[0] - startPoint[0]) /
                        4 +
                        startPoint[0],
                      (endPoint[1] - startPoint[1]) / 8 + startPoint[1],
                    ]),
                    (point3 = [
                      (startPoint[0] + endPoint[0]) / 2,
                      startPoint[1],
                    ]),
                    (point4 = [
                      (3 * (endPoint[0] - startPoint[0])) / 4 + startPoint[0],
                      -(endPoint[1] - startPoint[1]) / 8 + startPoint[1],
                    ]),
                    (point5 = [endPoint[0], startPoint[1]]),
                    (point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2]),
                    (point7 = [
                      (3 * (endPoint[0] - startPoint[0])) / 4 + startPoint[0],
                      (3 * (endPoint[1] - startPoint[1])) / 8 + startPoint[1],
                    ]),
                    (point8 = [
                      (startPoint[0] + endPoint[0]) / 2,
                      (startPoint[1] + endPoint[1]) / 2,
                    ]),
                    (point9 = [
                      (endPoint[0] - startPoint[0]) / 4 + startPoint[0],
                      (5 * (endPoint[1] - startPoint[1])) / 8 + startPoint[1],
                    ]),
                    (point10 = [
                      startPoint[0],
                      (startPoint[1] + endPoint[1]) / 2,
                    ]),
                    (endPoint = [startPoint[0], endPoint[1]]),
                    (startPoint = this.plotUtil.getBezierPoints([
                      startPoint,
                      point2,
                      point3,
                      point4,
                      point5,
                    ])),
                    (point2 = this.plotUtil.getBezierPoints([
                      point6,
                      point7,
                      point8,
                      point9,
                      point10,
                    ])),
                    (pList = startPoint.concat(point2)).push(endPoint)),
                  []),
                k = 0;
              k < pList.length;
              k++
            ) {
              var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      CurveFlag
    );
  })(),
  DoubleArrow = (function () {
    function DoubleArrow(arg) {
      _classCallCheck(this, DoubleArrow);
      var opt = {};
      (opt.headHeightFactor = (arg = arg || {}).headHeightFactor || 0.25),
        (opt.headWidthFactor = arg.headWidthFactor || 0.3),
        (opt.neckHeightFactor = arg.neckHeightFactor || 0.85),
        (opt.neckWidthFactor = arg.neckWidthFactor || 0.15),
        (this.positions = void 0),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(DoubleArrow, [
        {
          key: "startCompute",
          value: function (positions) {
            if (positions) {
              this.positions = positions;
              for (var pnts = [], i = 0; i < positions.length; i++) {
                var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
                pnts.push(newP);
              }
              for (
                var _ref = [pnts[0], pnts[1], pnts[2]],
                  pnt1 = _ref[0],
                  pnt2 = _ref[1],
                  _ref = _ref[2],
                  count = this.positions.length,
                  count =
                    3 === count
                      ? ((tempPoint4 = this.getTempPoint4(pnt1, pnt2, _ref)),
                        this.plotUtil.Mid(pnt1, pnt2))
                      : 4 === count
                      ? ((tempPoint4 = pnts[3]), this.plotUtil.Mid(pnt1, pnt2))
                      : ((tempPoint4 = pnts[3]), pnts[4]),
                  leftArrowPnts = void 0,
                  rightArrowPnts = void 0,
                  rightArrowPnts = this.plotUtil.isClockWise(pnt1, pnt2, _ref)
                    ? ((leftArrowPnts = this.getArrowPoints(
                        pnt1,
                        count,
                        tempPoint4,
                        !1
                      )),
                      this.getArrowPoints(count, pnt2, _ref, !0))
                    : ((leftArrowPnts = this.getArrowPoints(
                        pnt2,
                        count,
                        _ref,
                        !1
                      )),
                      this.getArrowPoints(count, pnt1, tempPoint4, !0)),
                  pnt2 = leftArrowPnts.length,
                  _ref = (pnt2 - 5) / 2,
                  count = leftArrowPnts.slice(0, _ref),
                  pnt1 = leftArrowPnts.slice(_ref, 5 + _ref),
                  tempPoint4 = leftArrowPnts.slice(5 + _ref, pnt2),
                  leftArrowPnts = rightArrowPnts.slice(0, _ref),
                  rArrowPnts = rightArrowPnts.slice(_ref, 5 + _ref),
                  rightArrowPnts = rightArrowPnts.slice(5 + _ref, pnt2),
                  leftArrowPnts = this.plotUtil.getBezierPoints(leftArrowPnts),
                  _ref = this.plotUtil.getBezierPoints(
                    rightArrowPnts.concat(count.slice(1))
                  ),
                  tempPoint4 = this.plotUtil.getBezierPoints(tempPoint4),
                  newPnts = leftArrowPnts.concat(
                    rArrowPnts,
                    _ref,
                    pnt1,
                    tempPoint4
                  ),
                  returnArr = [],
                  k = 0;
                k < newPnts.length;
                k++
              ) {
                var posi = this.plotUtil.webMercator2Cartesian3(newPnts[k]);
                returnArr.push(posi);
              }
              return returnArr;
            }
          },
        },
        {
          key: "getTempPoint4",
          value: function (linePnt1, linePnt2, point) {
            var linePnt2 = this.plotUtil.Mid(linePnt1, linePnt2),
              len = this.plotUtil.MathDistance(linePnt2, point),
              point = this.plotUtil.getAngleOfThreePoints(
                linePnt1,
                linePnt2,
                point
              ),
              distance1 = void 0,
              distance2 = void 0,
              mid = void 0;
            return point < Math.PI / 2
              ? ((distance1 = len * Math.sin(point)),
                (distance2 = len * Math.cos(point)),
                (mid = this.plotUtil.getThirdPoint(
                  linePnt1,
                  linePnt2,
                  Math.PI / 2,
                  distance1,
                  !1
                )),
                this.plotUtil.getThirdPoint(
                  linePnt2,
                  mid,
                  Math.PI / 2,
                  distance2,
                  !0
                ))
              : point >= Math.PI / 2 && point < Math.PI
              ? ((distance1 = len * Math.sin(Math.PI - point)),
                (distance2 = len * Math.cos(Math.PI - point)),
                (mid = this.plotUtil.getThirdPoint(
                  linePnt1,
                  linePnt2,
                  Math.PI / 2,
                  distance1,
                  !1
                )),
                this.plotUtil.getThirdPoint(
                  linePnt2,
                  mid,
                  Math.PI / 2,
                  distance2,
                  !1
                ))
              : point >= Math.PI && point < 1.5 * Math.PI
              ? ((distance1 = len * Math.sin(point - Math.PI)),
                (distance2 = len * Math.cos(point - Math.PI)),
                (mid = this.plotUtil.getThirdPoint(
                  linePnt1,
                  linePnt2,
                  Math.PI / 2,
                  distance1,
                  !0
                )),
                this.plotUtil.getThirdPoint(
                  linePnt2,
                  mid,
                  Math.PI / 2,
                  distance2,
                  !0
                ))
              : ((distance1 = len * Math.sin(2 * Math.PI - point)),
                (distance2 = len * Math.cos(2 * Math.PI - point)),
                (mid = this.plotUtil.getThirdPoint(
                  linePnt1,
                  linePnt2,
                  Math.PI / 2,
                  distance1,
                  !0
                )),
                this.plotUtil.getThirdPoint(
                  linePnt2,
                  mid,
                  Math.PI / 2,
                  distance2,
                  !1
                ));
          },
        },
        {
          key: "getArrowPoints",
          value: function (pnt1, pnt2, pnt3, clockWise) {
            var midPnt = this.plotUtil.Mid(pnt1, pnt2),
              len = this.plotUtil.MathDistance(midPnt, pnt3),
              midPnt1 = this.plotUtil.getThirdPoint(
                pnt3,
                midPnt,
                0,
                0.3 * len,
                !0
              ),
              midPnt2 = this.plotUtil.getThirdPoint(
                pnt3,
                midPnt,
                0,
                0.5 * len,
                !0
              ),
              midPnt1 = [
                midPnt,
                this.plotUtil.getThirdPoint(
                  midPnt,
                  midPnt1,
                  Math.PI / 2,
                  len / 5,
                  clockWise
                ),
                this.plotUtil.getThirdPoint(
                  midPnt,
                  midPnt2,
                  Math.PI / 2,
                  len / 4,
                  clockWise
                ),
                pnt3,
              ],
              midPnt = this.plotUtil.getArrowHeadPointsNoLR(midPnt1);
            if (!(midPnt && Array.isArray(midPnt) && 0 < midPnt.length))
              throw new Error("插值出错");
            var midPnt2 = [midPnt[0], midPnt[4]],
              len = midPnt2[0],
              clockWise = midPnt2[1],
              pnt3 =
                this.plotUtil.MathDistance(pnt1, pnt2) /
                this.plotUtil.getBaseLength(midPnt1) /
                2,
              midPnt2 = this.plotUtil.getArrowBodyPoints(
                midPnt1,
                len,
                clockWise,
                pnt3
              );
            if (midPnt2)
              return (
                (midPnt1 = midPnt2.length),
                (pnt3 = midPnt2.slice(0, midPnt1 / 2)),
                (midPnt2 = midPnt2.slice(midPnt1 / 2, midPnt1)),
                pnt3.push(len),
                midPnt2.push(clockWise),
                (pnt3 = pnt3.reverse()).push(pnt2),
                (midPnt2 = midPnt2.reverse()).push(pnt1),
                pnt3.reverse().concat(midPnt, midPnt2)
              );
          },
        },
      ]),
      DoubleArrow
    );
  })(),
  FineArrow = (function () {
    function FineArrow(arg) {
      _classCallCheck(this, FineArrow);
      var opt = {};
      (opt.headAngle = this.headAngle =
        (arg = arg || {}).headAngle || Math.PI / 8.5),
        (opt.neckAngle = this.neckAngle = arg.neckAngle || Math.PI / 13),
        (opt.tailWidthFactor = this.tailWidthFactor =
          arg.tailWidthFactor || 0.1),
        (opt.neckWidthFactor = this.neckWidthFactor =
          arg.neckWidthFactor || 0.2),
        (opt.headWidthFactor = this.headWidthFactor =
          arg.headWidthFactor || 0.25),
        (opt.neckHeightFactor = arg.neckHeightFactor || 0.85),
        (this.positions = void 0),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(FineArrow, [
        {
          key: "startCompute",
          value: function (positions) {
            if (positions) {
              this.positions = positions;
              for (var pnts = [], i = 0; i < positions.length; i++) {
                var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
                pnts.push(newP);
              }
              for (
                var _ref = [pnts[0], pnts[1]],
                  pnt1 = _ref[0],
                  _ref = _ref[1],
                  len = this.plotUtil.getBaseLength(pnts),
                  tailWidth = len * this.tailWidthFactor,
                  neckWidth = len * this.neckWidthFactor,
                  len = len * this.headWidthFactor,
                  tailLeft = this.plotUtil.getThirdPoint(
                    _ref,
                    pnt1,
                    Math.PI / 2,
                    tailWidth,
                    !0
                  ),
                  tailWidth = this.plotUtil.getThirdPoint(
                    _ref,
                    pnt1,
                    Math.PI / 2,
                    tailWidth,
                    !1
                  ),
                  headLeft = this.plotUtil.getThirdPoint(
                    pnt1,
                    _ref,
                    this.headAngle,
                    len,
                    !1
                  ),
                  len = this.plotUtil.getThirdPoint(
                    pnt1,
                    _ref,
                    this.headAngle,
                    len,
                    !0
                  ),
                  pList = [
                    tailLeft,
                    this.plotUtil.getThirdPoint(
                      pnt1,
                      _ref,
                      this.neckAngle,
                      neckWidth,
                      !1
                    ),
                    headLeft,
                    _ref,
                    len,
                    this.plotUtil.getThirdPoint(
                      pnt1,
                      _ref,
                      this.neckAngle,
                      neckWidth,
                      !0
                    ),
                    tailWidth,
                  ],
                  returnArr = [],
                  k = 0;
                k < pList.length;
                k++
              ) {
                var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
                returnArr.push(posi);
              }
              return returnArr;
            }
          },
        },
      ]),
      FineArrow
    );
  })(),
  FineArrowYW = (function () {
    function FineArrowYW(arg) {
      _classCallCheck(this, FineArrowYW);
      var opt = {};
      (opt.headHeightFactor = (arg = arg || {}).headHeightFactor || 0.18),
        (opt.headWidthFactor = arg.headWidthFactor || 0.3),
        (opt.neckHeightFactor = arg.neckHeightFactor || 0.85),
        (opt.neckWidthFactor = arg.neckWidthFactor || 0.15),
        (opt.tailWidthFactor = this.tailWidthFactor =
          arg.tailWidthFactor || 0.1),
        (opt.swallowTailFactor = this.swallowTailFactor =
          arg.swallowTailFactor || 1),
        (this.positions = void 0),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(FineArrowYW, [
        {
          key: "startCompute",
          value: function (positions) {
            if (positions) {
              this.positions = positions;
              for (var pnts = [], i = 0; i < positions.length; i++) {
                var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
                pnts.push(newP);
              }
              for (
                var tailPnts = this.getTailPoints(pnts),
                  headPnts = this.plotUtil.getArrowHeadPoints(
                    pnts,
                    tailPnts[0],
                    tailPnts[2]
                  ),
                  neckLeft = headPnts[0],
                  neckRight = headPnts[4],
                  bodyPnts = this.plotUtil.getArrowBodyPoints(
                    pnts,
                    neckLeft,
                    neckRight,
                    this.tailWidthFactor
                  ),
                  _count = bodyPnts.length,
                  leftPnts = [tailPnts[0]].concat(
                    bodyPnts.slice(0, _count / 2)
                  ),
                  neckLeft =
                    (leftPnts.push(neckLeft),
                    [tailPnts[2]].concat(bodyPnts.slice(_count / 2, _count))),
                  pList =
                    (neckLeft.push(neckRight),
                    (leftPnts = this.plotUtil.getQBSplinePoints(leftPnts)),
                    (neckLeft = this.plotUtil.getQBSplinePoints(neckLeft)),
                    leftPnts.concat(headPnts, neckLeft.reverse(), [
                      tailPnts[1],
                      leftPnts[0],
                    ])),
                  returnArr = [],
                  k = 0;
                k < pList.length;
                k++
              ) {
                var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
                returnArr.push(posi);
              }
              return returnArr;
            }
          },
        },
        {
          key: "getTailPoints",
          value: function (points) {
            var tailWidth =
                this.plotUtil.getBaseLength(points) * this.tailWidthFactor,
              tailLeft = this.plotUtil.getThirdPoint(
                points[1],
                points[0],
                Math.PI / 2,
                tailWidth,
                !1
              ),
              tailRight = this.plotUtil.getThirdPoint(
                points[1],
                points[0],
                Math.PI / 2,
                tailWidth,
                !0
              ),
              tailWidth = tailWidth * this.swallowTailFactor;
            return [
              tailLeft,
              this.plotUtil.getThirdPoint(
                points[1],
                points[0],
                0,
                tailWidth,
                !0
              ),
              tailRight,
            ];
          },
        },
      ]),
      FineArrowYW
    );
  })(),
  GatheringPlace = (function () {
    function GatheringPlace(opt) {
      _classCallCheck(this, GatheringPlace),
        (opt = opt || {}),
        (this.positions = void 0),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(GatheringPlace, [
        {
          key: "startCompute",
          value: function (positions) {
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            for (
              var mid = this.plotUtil.Mid(pnts[0], pnts[2]),
                normals = (pnts.push(mid, pnts[0], pnts[1]), []),
                pnt1 = void 0,
                pnt2 = void 0,
                pList = [],
                _i3 = 0;
              _i3 < pnts.length - 2;
              _i3++
            )
              var pnt1 = pnts[_i3],
                pnt2 = pnts[_i3 + 1],
                pnt3 = pnts[_i3 + 2],
                pnt3 = this.plotUtil.getBisectorNormals(0.4, pnt1, pnt2, pnt3),
                normals = normals.concat(pnt3);
            mid = normals.length;
            normals = [normals[mid - 1]].concat(normals.slice(0, mid - 1));
            for (var _i = 0; _i < pnts.length - 2; _i++) {
              (pnt1 = pnts[_i]), (pnt2 = pnts[_i + 1]), pList.push(pnt1);
              for (var t = 0; t <= 100; t++) {
                var _pnt = this.plotUtil.getCubicValue(
                  t / 100,
                  pnt1,
                  normals[2 * _i],
                  normals[2 * _i + 1],
                  pnt2
                );
                pList.push(_pnt);
              }
              pList.push(pnt2);
            }
            for (var returnArr = [], k = 0; k < pList.length; k++) {
              var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      GatheringPlace
    );
  })(),
  LineStraightArrow = (function () {
    function LineStraightArrow(arg) {
      _classCallCheck(this, LineStraightArrow);
      (this.typeName = "LineStraightArrow"),
        (this.plotUtil = new ArrowUtil({})),
        (this.fixPointCount = 2),
        (this.maxArrowLength = 3e6),
        (this.arrowLengthScale = 5);
    }
    return (
      _createClass(LineStraightArrow, [
        {
          key: "startCompute",
          value: function (positions) {
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            var pList = [];
            try {
              if (pnts.length < 2) return !1;
              var _ref = [pnts[0], pnts[1]],
                pnt1 = _ref[0],
                pnt2 = _ref[1],
                len =
                  (len =
                    this.plotUtil.MathDistance(pnt1, pnt2) /
                    this.arrowLengthScale) > this.maxArrowLength
                    ? this.maxArrowLength
                    : len,
                pList = [
                  pnt1,
                  pnt2,
                  this.plotUtil.getThirdPoint(pnt1, pnt2, Math.PI / 6, len, !1),
                  pnt2,
                  this.plotUtil.getThirdPoint(pnt1, pnt2, Math.PI / 6, len, !0),
                ];
            } catch (e) {
              console.log(e);
            }
            for (var returnArr = [], k = 0; k < pList.length; k++) {
              var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      LineStraightArrow
    );
  })(),
  Lune = (function () {
    function Lune(opt) {
      _classCallCheck(this, Lune),
        (opt = opt || {}),
        (this.positions = void 0),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(Lune, [
        {
          key: "startCompute",
          value: function (positions) {
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            var _ref = [pnts[0], pnts[1], pnts[2], void 0, void 0],
              pnt1 = _ref[0],
              pnt2 = _ref[1],
              pnt3 = _ref[2],
              startAngle = _ref[3],
              _ref = _ref[4],
              center = this.plotUtil.getCircleCenterOfThreePoints(
                pnt1,
                pnt2,
                pnt3
              ),
              radius = this.plotUtil.MathDistance(pnt1, center),
              angle1 = this.plotUtil.getAzimuth(pnt1, center),
              angle2 = this.plotUtil.getAzimuth(pnt2, center),
              _ref = this.plotUtil.isClockWise(pnt1, pnt2, pnt3)
                ? ((startAngle = angle2), angle1)
                : ((startAngle = angle1), angle2);
            (pnts = this.plotUtil.getArcPoints(
              center,
              radius,
              startAngle,
              _ref
            )).push(pnts[0]);
            for (var returnArr = [], k = 0; k < pnts.length; k++) {
              var posi = this.plotUtil.webMercator2Cartesian3(pnts[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      Lune
    );
  })(),
  RectFlag = (function () {
    function RectFlag(opt) {
      _classCallCheck(this, RectFlag),
        ((opt = opt || {}).typeName = "RectFlag"),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(RectFlag, [
        {
          key: "startCompute",
          value: function (positions) {
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            for (
              var startPoint,
                endPoint,
                components = [],
                returnArr =
                  (1 < pnts.length &&
                    (components = [
                      (startPoint = pnts[0]),
                      [(endPoint = pnts[pnts.length - 1])[0], startPoint[1]],
                      [endPoint[0], (startPoint[1] + endPoint[1]) / 2],
                      [startPoint[0], (startPoint[1] + endPoint[1]) / 2],
                      [startPoint[0], endPoint[1]],
                    ]),
                  []),
                k = 0;
              k < components.length;
              k++
            ) {
              var posi = this.plotUtil.webMercator2Cartesian3(components[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      RectFlag
    );
  })(),
  Sector = (function () {
    function Sector(arg) {
      _classCallCheck(this, Sector);
      (this.typeName = "Sector"), (this.plotUtil = new ArrowUtil({}));
    }
    return (
      _createClass(Sector, [
        {
          key: "startCompute",
          value: function (positions) {
            if (positions.length <= 2) return [];
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            for (
              var _ref = [pnts[0], pnts[1], pnts[2]],
                center = _ref[0],
                pnt2 = _ref[1],
                _ref = _ref[2],
                radius = this.plotUtil.MathDistance(pnt2, center),
                pnt2 = this.plotUtil.getAzimuth(pnt2, center),
                _ref = this.plotUtil.getAzimuth(_ref, center),
                pList = this.plotUtil.getArcPoints(center, radius, pnt2, _ref),
                returnArr = (pList.push(center, pList[0]), []),
                k = 0;
              k < pList.length;
              k++
            ) {
              var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      Sector
    );
  })(),
  StraightArrow = (function () {
    function StraightArrow(arg) {
      _classCallCheck(this, StraightArrow);
      var opt = {};
      (opt.tailWidthFactor = this.tailWidthFactor =
        (arg = arg || {}).tailWidthFactor || 0.05),
        (opt.neckWidthFactor = this.neckWidthFactor =
          arg.neckWidthFactor || 0.1),
        (opt.headWidthFactor = this.headWidthFactor =
          arg.headWidthFactor || 0.15),
        (this.headAngle = Math.PI / 4),
        (this.neckAngle = 0.17741 * Math.PI),
        (this.positions = void 0),
        (this.plotUtil = new ArrowUtil(opt));
    }
    return (
      _createClass(StraightArrow, [
        {
          key: "startCompute",
          value: function (positions) {
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            for (
              var _ref = [pnts[0], pnts[1]],
                pnt1 = _ref[0],
                _ref = _ref[1],
                len = this.plotUtil.getBaseLength(pnts),
                tailWidth = len * this.tailWidthFactor,
                neckWidth = len * this.neckWidthFactor,
                len = len * this.headWidthFactor,
                tailLeft = this.plotUtil.getThirdPoint(
                  _ref,
                  pnt1,
                  Math.PI / 2,
                  tailWidth,
                  !0
                ),
                tailWidth = this.plotUtil.getThirdPoint(
                  _ref,
                  pnt1,
                  Math.PI / 2,
                  tailWidth,
                  !1
                ),
                headLeft = this.plotUtil.getThirdPoint(
                  pnt1,
                  _ref,
                  this.headAngle,
                  len,
                  !1
                ),
                len = this.plotUtil.getThirdPoint(
                  pnt1,
                  _ref,
                  this.headAngle,
                  len,
                  !0
                ),
                pList = [
                  tailLeft,
                  this.plotUtil.getThirdPoint(
                    pnt1,
                    _ref,
                    this.neckAngle,
                    neckWidth,
                    !1
                  ),
                  headLeft,
                  _ref,
                  len,
                  this.plotUtil.getThirdPoint(
                    pnt1,
                    _ref,
                    this.neckAngle,
                    neckWidth,
                    !0
                  ),
                  tailWidth,
                ],
                returnArr = [],
                k = 0;
              k < pList.length;
              k++
            ) {
              var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      StraightArrow
    );
  })(),
  TrangleFlag = (function () {
    function TrangleFlag(arg) {
      _classCallCheck(this, TrangleFlag);
      (this.typeName = "TrangleFlag"), (this.plotUtil = new ArrowUtil({}));
    }
    return (
      _createClass(TrangleFlag, [
        {
          key: "startCompute",
          value: function (positions) {
            for (var pnts = [], i = 0; i < positions.length; i++) {
              var newP = this.plotUtil.cartesian32WeMercator(positions[i]);
              pnts.push(newP);
            }
            for (
              var startPoint,
                endPoint,
                pList = [],
                returnArr =
                  (1 < pnts.length &&
                    (pList = [
                      (startPoint = pnts[0]),
                      [
                        (endPoint = pnts[pnts.length - 1])[0],
                        (startPoint[1] + endPoint[1]) / 2,
                      ],
                      [startPoint[0], (startPoint[1] + endPoint[1]) / 2],
                      [startPoint[0], endPoint[1]],
                    ]),
                  []),
                k = 0;
              k < pList.length;
              k++
            ) {
              var posi = this.plotUtil.webMercator2Cartesian3(pList[k]);
              returnArr.push(posi);
            }
            return returnArr;
          },
        },
      ]),
      TrangleFlag
    );
  })(),
  ArrowAlgorithm = {
    AttackArrow: AttackArrow,
    AttackArrowPW: AttackArrowPW,
    AttackArrowYW: AttackArrowYW,
    CloseCurve: CloseCurve,
    Curve: Curve,
    CurveFlag: CurveFlag,
    DoubleArrow: DoubleArrow,
    FineArrow: FineArrow,
    FineArrowYW: FineArrowYW,
    GatheringPlace: GatheringPlace,
    StraightArrow: StraightArrow,
    LineStraightArrow: LineStraightArrow,
    TrangleFlag: TrangleFlag,
    Lune: Lune,
    RectFlag: RectFlag,
    Sector: Sector,
  },
  CreateArrow = (function () {
    _inherits(CreateArrow, BasePlot);
    var _super = _createSuper(CreateArrow);
    function CreateArrow(viewer, opt) {
      _classCallCheck(this, CreateArrow),
        ((_this = _super.call(this, viewer, opt)).opt = opt || {});
      var _this,
        opt = _this.opt || {},
        arrowType = opt.arrowType,
        opt = opt.style;
      if (((_this.type = "arrow"), !arrowType))
        return console.log("缺少箭头类型"), _possibleConstructorReturn(_this);
      if (
        ((_this.arrowType = arrowType),
        (_this.arrowObj = getSituationByType(arrowType)),
        !_this.arrowObj)
      )
        return _possibleConstructorReturn(_this);
      if (
        ((_this.minPointNum = _this.arrowObj.minPointNum),
        1 == _this.minPointNum)
      )
        return console.warn("控制点有误！"), _possibleConstructorReturn(_this);
      if (
        ((_this.maxPointNum =
          -1 == _this.arrowObj.maxPointNum
            ? _this.minPointNum
            : _this.arrowObj.maxPointNum),
        (_this.arrowPlot = _this.arrowObj.arrowPlot),
        !_this.arrowPlot)
      )
        return (
          console.warn("计算坐标类有误！"), _possibleConstructorReturn(_this)
        );
      (_this.viewer = viewer),
        (_this.entity = void 0),
        (_this.polyline = void 0);
      return (
        (_this.style = Object.assign(
          { outlineColor: "#ff0000", outlineWidth: 2 },
          opt || {}
        )),
        (_this.outline = void 0),
        _this
      );
    }
    return (
      _createClass(CreateArrow, [
        {
          key: "start",
          value: function (callback) {
            var that = this;
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              (this.state = "startCreate"),
              this.handler ||
                (this.handler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              this.handler.setInputAction(function (evt) {
                var evt = that.getCatesian3FromPX(evt.position, that.viewer);
                !evt ||
                  that.positions.length > that.maxPointNum ||
                  (that.movePush &&
                    (that.positions.pop(), (that.movePush = !1)),
                  that.positions.push(evt),
                  ((evt = that.createPoint(evt)).wz =
                    that.controlPoints.length),
                  that.controlPoints.push(evt),
                  that.setRightToolState(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                if (that.positions.length < 1)
                  that.prompt &&
                    that.prompt.update(evt.endPosition, "单击开始绘制"),
                    that.setRightToolState(!1),
                    (that.state = "startCreate");
                else {
                  if (that.positions.length == that.maxPointNum)
                    that.prompt &&
                      that.prompt.update(evt.endPosition, "双击结束");
                  else {
                    if (that.positions.length > that.maxPointNum)
                      return (
                        that.endCreate(),
                        void (callback && callback(that.entity))
                      );
                    that.prompt &&
                      that.prompt.update(
                        evt.endPosition,
                        "单击新增，不少于" +
                          that.minPointNum +
                          "个点</br>双击结束"
                      );
                  }
                  that.state = "creating";
                  evt = that.getCatesian3FromPX(evt.endPosition, that.viewer);
                  evt &&
                    (that.movePush
                      ? (that.positions[that.positions.length - 1] = evt)
                      : (that.positions.push(evt), (that.movePush = !0)),
                    2 <= that.positions.length &&
                      !Cesium.defined(that.polyline) &&
                      (that.polyline = that.createPolyline()),
                    that.positions.length >= that.minPointNum &&
                      !Cesium.defined(that.entity) &&
                      ((that.entity = that.createEntity()),
                      (that.entity.objId = that.objId),
                      (that.polyline.show = !1)));
                }
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.handler.setInputAction(function (evt) {
                that.entity &&
                  that.getCatesian3FromPX(evt.position, that.viewer, [
                    that.entity,
                  ]) &&
                  (that.positions.length >= that.minPointNum &&
                    that.endCreate(callback),
                  callback && callback(that.entity));
              }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
          },
        },
        {
          key: "endCreate",
          value: function () {
            this.movePush ||
              (this.positions.pop(),
              (this.movePush = !1),
              this.viewer.entities.remove(
                this.controlPoints[this.controlPoints.length - 1]
              ),
              this.controlPoints.pop()),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              this.handler.destroy(),
              (this.state = "endCreate");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "creating" == this.state
              ? this.positions.length <= 2 && 1 == this.movePush
                ? this.destroy()
                : this.endCreate()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "createByPositions",
          value: function (lnglatArr, callback) {
            if (lnglatArr) {
              this.state = "startCreate";
              var positions =
                lnglatArr[0] instanceof Cesium.Cartesian3
                  ? lnglatArr
                  : util$1.lnglatsToCartesians(lnglatArr);
              if (positions) {
                (this.entity = this.createEntity()),
                  (this.positions = positions);
                for (var i = 0; i < positions.length; i++) {
                  var newP = positions[i],
                    newP = this.createPoint(newP);
                  (newP.point.heightReference = this.style.heightReference),
                    (newP.ctgc = ctgc),
                    (newP.wz = this.controlPoints.length),
                    this.controlPoints.push(newP);
                }
                (this.state = "endCreate"),
                  (this.entity.objId = this.objId),
                  callback && callback(this.entity);
              }
            }
          },
        },
        {
          key: "getStyle",
          value: function () {
            var obj, entity, color;
            if (this.entity)
              return (
                (obj = {}),
                (entity = void 0),
                this.arrowPlot.onlyLine
                  ? (entity = this.entity.polyline)
                  : ((entity = this.entity.polygon),
                    (obj.fill = !!entity.fill && entity.fill.getValue())),
                (color = entity.material.color.getValue()),
                (obj.colorAlpha = color.alpha),
                (obj.color = new Cesium.Color(
                  color.red,
                  color.green,
                  color.blue,
                  1
                ).toCssHexString()),
                this.arrowPlot.onlyLine
                  ? ((color = entity.clampToGround.getValue()),
                    (obj.heightReference = Number(color)))
                  : ((color = entity.heightReference.getValue()),
                    (obj.heightReference = Number(color))),
                obj
              );
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            var material;
            style &&
              ((material = (
                style.color instanceof Cesium.Color
                  ? style.color
                  : Cesium.Color.fromCssColorString(style.color)
              ).withAlpha(style.colorAlpha || 1)),
              this.arrowPlot.onlyLine
                ? ((this.entity.polyline.material = material),
                  (this.entity.polyline.clampToGround = Boolean(
                    style.heightReference
                  )))
                : (this.arrowPlot.hasLine
                    ? ((this.entity.polyline.material = material),
                      (this.entity.polygon.material = material),
                      (this.entity.polyline.clampToGround = Boolean(
                        style.heightReference
                      )))
                    : (null != style.fill &&
                        (this.entity.polygon.fill = style.fill),
                      (this.entity.polygon.material = material)),
                  (this.entity.polygon.heightReference = Number(
                    style.heightReference
                  ))),
              (this.style = Object.assign(this.style, style)));
          },
        },
        {
          key: "createEntity",
          value: function () {
            var that = this,
              color =
                ((this.style.color = this.style.color || Cesium.Color.WHITE),
                (this.style.outlineColor =
                  this.style.outlineColor || Cesium.Color.BLACK),
                this.style.color instanceof Cesium.Color
                  ? this.style.color
                  : Cesium.Color.fromCssColorString(this.style.color).withAlpha(
                      this.style.colorAlpha || 1
                    )),
              entityObj = void 0,
              entityObj = that.arrowPlot.hasLine
                ? {
                    polygon: {
                      hierarchy: new Cesium.CallbackProperty(function () {
                        var newPosition = that.arrowPlot.startCompute(
                          that.positions
                        );
                        return (
                          void 0 !== that.arrowPlot.spliceWZ &&
                            newPosition.splice(that.arrowPlot.spliceWZ - 1, 1),
                          new Cesium.PolygonHierarchy(newPosition)
                        );
                      }, !1),
                      heightReference:
                        null == this.style.heightReference ? 0 : 1,
                      material: color,
                    },
                    polyline: {
                      positions: new Cesium.CallbackProperty(function () {
                        var newPosition = that.arrowPlot.startCompute(
                          that.positions
                        );
                        if (
                          that.arrowPlot.lineWZ &&
                          0 < that.arrowPlot.lineWZ.length
                        ) {
                          for (
                            var arr = [], i = 0;
                            i < that.arrowPlot.lineWZ.length;
                            i++
                          )
                            arr.push(newPosition[that.arrowPlot.lineWZ[i] - 1]);
                          return arr;
                        }
                        return newPosition;
                      }, !1),
                      material: color,
                      clampToGround: null != this.style.heightReference,
                      width: 3,
                    },
                  }
                : that.arrowPlot.onlyLine
                ? {
                    polyline: {
                      positions: new Cesium.CallbackProperty(function () {
                        var newPosition = that.arrowPlot.startCompute(
                          that.positions
                        );
                        if (
                          that.arrowPlot.lineWZ &&
                          0 < that.arrowPlot.lineWZ.length
                        ) {
                          for (
                            var arr = [], i = 0;
                            i < that.arrowPlot.lineWZ.length;
                            i++
                          )
                            arr.push(newPosition[that.arrowPlot.lineWZ[i] - 1]);
                          return arr;
                        }
                        return newPosition;
                      }, !1),
                      material: color,
                      clampToGround: null != this.style.heightReference,
                      width: 3,
                    },
                  }
                : {
                    polygon: {
                      hierarchy: new Cesium.CallbackProperty(function () {
                        var newPosition = that.arrowPlot.startCompute(
                          that.positions
                        );
                        return (
                          null != that.arrowPlot.spliceWZ &&
                            newPosition.splice(that.arrowPlot.spliceWZ - 1, 1),
                          new Cesium.PolygonHierarchy(newPosition)
                        );
                      }, !1),
                      heightReference: Number(this.style.heightReference),
                      show: !0,
                      fill: this.style.fill || !0,
                      material: color,
                    },
                  };
            return this.viewer.entities.add(entityObj);
          },
        },
        {
          key: "createPolyline",
          value: function () {
            var that = this;
            return this.viewer.entities.add({
              polyline: {
                positions: new Cesium.CallbackProperty(function () {
                  return that.positions;
                }, !1),
                clampToGround: Boolean(this.style.clampToGround),
                material:
                  this.style.outlineColor instanceof Cesium.Color
                    ? this.style.outlineColor
                    : Cesium.Color.fromCssColorString(
                        this.style.outlineColor
                      ).withAlpha(this.style.outlineColorAlpha || 1),
                width: this.style.outlineWidth || 1,
              },
            });
          },
        },
        {
          key: "destroy",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              this.entity &&
                (this.viewer.entities.remove(this.entity),
                (this.entity = void 0)),
              this.polyline &&
                (this.viewer.entities.remove(this.polyline),
                (this.polyline = void 0)),
              (this.positions = []),
              (this.style = void 0),
              this.modifyPoint &&
                (this.viewer.entities.remove(this.modifyPoint),
                (this.modifyPoint = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              this.viewer.entities.remove(point);
            }
            (this.controlPoints = []),
              (this.state = "no"),
              this.prompt && this.prompt.destroy(),
              this.polyline &&
                ((this.polyline = void 0),
                this.viewer.entities.remove(this.polyline)),
              this.forbidDrawWorld(!1);
          },
        },
      ]),
      CreateArrow
    );
  })();
function getSituationByType(type) {
  if (
    ((type = Number(type)), !isNaN(type)) &&
    type &&
    "number" == typeof type
  ) {
    var arrowPlot,
      minPointNum = -1,
      maxPointNum = -1,
      playObj = { canPlay: !1, pointNum: 0, pointWZ: [], canPlay: !1 };
    switch (type) {
      case 1:
        (arrowPlot = new ArrowAlgorithm.AttackArrow()),
          (minPointNum = 3),
          (maxPointNum = 999),
          (playObj.canPlay = !0),
          (playObj.pointNum = 1),
          (playObj.pointWZ = [maxPointNum]);
        break;
      case 2:
        (arrowPlot = new ArrowAlgorithm.AttackArrowPW()),
          (minPointNum = 3),
          (maxPointNum = 999),
          (playObj.canPlay = !0),
          (playObj.pointNum = 1),
          (playObj.pointWZ = [maxPointNum]);
        break;
      case 3:
        (arrowPlot = new ArrowAlgorithm.AttackArrowYW()),
          (minPointNum = 3),
          (maxPointNum = 999),
          (playObj.canPlay = !0),
          (playObj.pointNum = 1),
          (playObj.pointWZ = [maxPointNum]);
        break;
      case 4:
        (arrowPlot = new ArrowAlgorithm.CloseCurve()),
          (minPointNum = 3),
          (maxPointNum = 999),
          (playObj.canPlay = !0),
          (playObj.pointNum = 1),
          (playObj.pointWZ = [maxPointNum]);
        break;
      case 5:
        (arrowPlot = new ArrowAlgorithm.DoubleArrow()),
          (minPointNum = 3),
          (maxPointNum = 5),
          (playObj.canPlay = !0),
          (playObj.pointNum = 2),
          (playObj.pointWZ = [2, 3]);
        break;
      case 6:
        (arrowPlot = new ArrowAlgorithm.FineArrow()),
          (maxPointNum = minPointNum = 2),
          (playObj.canPlay = !0),
          (playObj.pointNum = 1),
          (playObj.pointWZ = [maxPointNum]);
        break;
      case 7:
        (arrowPlot = new ArrowAlgorithm.FineArrowYW()),
          (maxPointNum = minPointNum = 2),
          (playObj.canPlay = !0),
          (playObj.pointNum = 1),
          (playObj.pointWZ = [maxPointNum]);
        break;
      case 8:
        (arrowPlot = new ArrowAlgorithm.GatheringPlace()),
          (maxPointNum = minPointNum = 3),
          (playObj.canPlay = !0),
          (playObj.pointNum = 1),
          (playObj.pointWZ = [maxPointNum]);
        break;
      case 9:
        (arrowPlot = new ArrowAlgorithm.Lune()),
          (minPointNum = 3),
          (playObj.canPlay = !0),
          (maxPointNum = 3),
          (playObj.canPlay = !0),
          (playObj.pointNum = 1),
          (playObj.pointWZ = [maxPointNum]);
        break;
      case 10:
        (arrowPlot = new ArrowAlgorithm.StraightArrow()),
          (maxPointNum = minPointNum = 2),
          (playObj.canPlay = !0),
          (playObj.pointNum = 1),
          (playObj.pointWZ = [maxPointNum]);
        break;
      case 11:
        (maxPointNum = minPointNum = 2),
          ((arrowPlot = new ArrowAlgorithm.RectFlag()).hasLine = !0),
          (arrowPlot.lineWZ = [1, 4, 5]),
          (arrowPlot.spliceWZ = [5]),
          (playObj.canPlay = !1);
        break;
      case 12:
        (arrowPlot = new ArrowAlgorithm.Sector()),
          (playObj.canPlay = !(maxPointNum = minPointNum = 3));
        break;
      case 13:
        (maxPointNum = minPointNum = 2),
          ((arrowPlot = new ArrowAlgorithm.TrangleFlag()).hasLine = !0),
          (arrowPlot.lineWZ = [1, 3, 4]),
          (arrowPlot.spliceWZ = [4]),
          (playObj.canPlay = !1);
        break;
      case 14:
        (maxPointNum = minPointNum = 2),
          ((arrowPlot = new ArrowAlgorithm.CurveFlag()).hasLine = !0),
          (arrowPlot.lineWZ = [1, 202, 203]),
          (arrowPlot.spliceWZ = [203]),
          (playObj.canPlay = !1);
        break;
      case 15:
        (minPointNum = 2),
          (maxPointNum = 999),
          ((arrowPlot = new ArrowAlgorithm.Curve()).onlyLine = !0),
          (playObj.canPlay = !0);
        break;
      case 16:
        (maxPointNum = minPointNum = 2),
          ((arrowPlot = new ArrowAlgorithm.LineStraightArrow()).onlyLine = !0),
          (playObj.canPlay = !0);
        break;
      default:
        console.warn("不存在该类型！");
    }
    return {
      arrowPlot: arrowPlot,
      minPointNum: minPointNum,
      maxPointNum: maxPointNum,
      playObj: playObj,
    };
  }
  console.warn("输入态势标绘类型不对！");
}
var DrawTool = (function () {
    function DrawTool(viewer, obj) {
      _classCallCheck(this, DrawTool),
        viewer
          ? ((obj = obj || {}),
            (this.viewer = viewer),
            (this.plotId = Number(
              new Date().getTime() + "" + Number(1e3 * Math.random()).toFixed(0)
            )),
            (this.entityObjArr = []),
            (this.handler = void 0),
            (this.removeHandler = new Cesium.ScreenSpaceEventHandler(
              this.viewer.scene.canvas
            )),
            (this.startEditFun = void 0),
            (this.endEditFun = void 0),
            (this.removeFun = void 0),
            (this.editingFun = void 0),
            (this.deleteEntityObj = void 0),
            this.bindEdit(),
            this.bindRemove(),
            (this.canEdit = null == obj.canEdit || obj.canEdit),
            (this.canRemove = null == obj.canRemove || obj.canRemove),
            (this.fireEdit = null == obj.fireEdit || obj.fireEdit),
            (this.nowDrawEntityObj = void 0),
            (this.nowEditEntityObj = void 0))
          : console.warn("缺少必要参数！--viewer");
    }
    return (
      _createClass(DrawTool, [
        {
          key: "on",
          value: function (type, fun) {
            "startEdit" == type && (this.startEditFun = fun),
              "endEdit" == type && (this.endEditFun = fun),
              "remove" == type && (this.removeFun = fun),
              "endCreate" == type && (this.endCreateFun = fun),
              "editing" == type && (this.editingFun = fun);
          },
        },
        {
          key: "openEdit",
          value: function () {
            this.canEdit = !0;
          },
        },
        {
          key: "closeEdit",
          value: function () {
            this.endEdit(), (this.canEdit = !1);
          },
        },
        {
          key: "start",
          value: function (opt) {
            if (opt && opt.type) {
              (opt.id =
                opt.id ||
                Number(
                  new Date().getTime() +
                    "" +
                    Number(1e3 * Math.random()).toFixed(0)
                )),
                (opt.plotId = this.plotId);
              var that = this,
                entityObj =
                  (this.endEdit(),
                  !this.nowDrawEntityObj ||
                    ("startCreate" != this.nowDrawEntityObj.state &&
                      "creating" != this.nowDrawEntityObj.state) ||
                    (this.nowDrawEntityObj.destroy(),
                    (this.nowDrawEntityObj = void 0)),
                  this.createByType(opt));
              if (entityObj)
                return (
                  (entityObj.attr = opt || {}),
                  entityObj.start(function (entity) {
                    (that.nowDrawEntityObj = void 0),
                      that.entityObjArr.push(entityObj),
                      opt.success && opt.success(entityObj, entity),
                      that.endCreateFun && that.endCreateFun(entityObj, entity),
                      0 == opt.show && entityObj.setVisible(!1),
                      that.canEdit &&
                        that.fireEdit &&
                        (entityObj.startEdit(function () {
                          that.editingFun &&
                            that.editingFun(entityObj, entityObj.entity);
                        }),
                        (that.nowEditEntityObj = entityObj),
                        that.startEditFun &&
                          that.startEditFun(entityObj, entity));
                  }),
                  (this.nowDrawEntityObj = entityObj)
                );
            }
          },
        },
        {
          key: "bindEdit",
          value: function () {
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                if (that.canEdit && !that.nowDrawEntityObj) {
                  var pick = that.viewer.scene.pick(evt.position);
                  if (Cesium.defined(pick) && pick.id) {
                    for (var i = 0; i < that.entityObjArr.length; i++)
                      if (
                        pick.id.objId == that.entityObjArr[i].objId &&
                        ("startCreate" != that.entityObjArr[i].state ||
                          "creating" != that.entityObjArr[i].state ||
                          "endEdit" != that.entityObjArr[i].state)
                      ) {
                        that.nowEditEntityObj &&
                          (that.nowEditEntityObj.endEdit(),
                          that.endEditFun &&
                            that.endEditFun(
                              that.nowEditEntityObj,
                              that.nowEditEntityObj.getEntity()
                            ),
                          (that.nowEditEntityObj = void 0)),
                          that.entityObjArr[i].startEdit(function () {
                            that.editingFun &&
                              that.editingFun(
                                that.nowEditEntityObj,
                                that.nowEditEntityObj.entity
                              );
                          }),
                          that.startEditFun &&
                            that.startEditFun(that.entityObjArr[i], pick.id),
                          (that.nowEditEntityObj = that.entityObjArr[i]);
                        break;
                      }
                  } else
                    that.nowEditEntityObj &&
                      (that.nowEditEntityObj.endEdit(),
                      that.endEditFun &&
                        that.endEditFun(
                          that.nowEditEntityObj,
                          that.nowEditEntityObj.getEntity()
                        ),
                      (that.nowEditEntityObj = void 0));
                }
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
          },
        },
        {
          key: "end",
          value: function () {
            this.nowDrawEntityObj;
          },
        },
        {
          key: "startEditOne",
          value: function (entityObj) {
            var that;
            this.canEdit &&
              (this.nowEditEntityObj &&
                (this.nowEditEntityObj.endEdit(),
                this.endEditFun &&
                  this.endEditFun(
                    this.nowEditEntityObj,
                    this.nowEditEntityObj.getEntity()
                  ),
                (this.nowEditEntityObj = void 0)),
              (that = this),
              entityObj &&
                (entityObj.startEdit(function () {
                  that.editingFun &&
                    that.editingFun(entityObj, entityObj.entity);
                }),
                this.startEditFun &&
                  this.startEditFun(entityObj, entityObj.getEntity()),
                (this.nowEditEntityObj = entityObj)));
          },
        },
        {
          key: "updateOneStyle",
          value: function (entityObj, style) {
            entityObj && entityObj.setStyle(style);
          },
        },
        {
          key: "createByPositions",
          value: function (opt) {
            if ((opt = (opt = opt || {}) || {}).positions) {
              (opt.id =
                opt.id ||
                Number(
                  new Date().getTime() +
                    "" +
                    Number(1e3 * Math.random()).toFixed(0)
                )),
                (opt.plotId = this.plotId);
              var that = this,
                entityObj = this.createByType(opt);
              if (entityObj)
                return (
                  (entityObj.attr = opt),
                  entityObj.createByPositions(opt.positions, function (entity) {
                    that.entityObjArr.push(entityObj),
                      entityObj.setStyle(opt.style),
                      opt.success && opt.success(entityObj, entity),
                      that.endCreateFun && that.endCreateFun(entityObj, entity),
                      0 == opt.show && entityObj.setVisible(!1),
                      that.canEdit &&
                        that.fireEdit &&
                        (entityObj.startEdit(function () {
                          that.editingFun &&
                            that.editingFun(entityObj, entityObj.entity);
                        }),
                        that.startEditFun &&
                          that.startEditFun(entityObj, entity),
                        (that.nowEditEntityObj = entityObj));
                  }),
                  entityObj
                );
            }
          },
        },
        {
          key: "createByGeojson",
          value: function (data) {
            for (
              var features = data.features, entObjArr = [], i = 0;
              i < features.length;
              i++
            ) {
              var feature = features[i],
                properties = feature.properties,
                feature = feature.geometry,
                plotType = properties.plotType,
                geoType = feature.type,
                coordinates = feature.coordinates,
                positions = [],
                drawType = "";
              switch (geoType) {
                case "MultiLineString":
                  coordinates.forEach(function (cr) {
                    (positions = util$1.lnglatsToCartesians(cr)),
                      (drawType = "polyline");
                  });
                  break;
                case "LineString":
                  (positions = util$1.lnglatsToCartesians(coordinates)),
                    (drawType = "polyline");
                  break;
                case "Polygon":
                  (positions = util$1.lnglatsToCartesians(coordinates[0])),
                    (drawType = "polygon");
                  break;
                case "Point":
                  (positions = util$1.lnglatsToCartesians(coordinates)[0]),
                    (drawType = plotType);
              }
              this.fireEdit = !1;
              feature = this.createByPositions({
                type: drawType,
                styleType: plotType,
                positions: positions,
                style: properties.style,
              });
              (feature.attr = properties), feature && entObjArr.push(feature);
            }
            return entObjArr;
          },
        },
        {
          key: "toGeojson",
          value: function () {
            var featureCollection = { type: "FeatureCollection", features: [] };
            if (0 == this.entityObjArr.length) return null;
            for (var i = 0; i < this.entityObjArr.length; i++) {
              for (
                var item = this.entityObjArr[i],
                  lnglats = item.getPositions(!0),
                  coordinates = [],
                  step = 0;
                step < lnglats.length;
                step++
              )
                coordinates.push([lnglats[step][0], lnglats[step][1]]);
              var style = item.getStyle(),
                geoType = this.transType(item.type),
                feature = {
                  type: "Feature",
                  properties: { plotType: item.type, style: style },
                  geometry: { type: geoType, coordinates: [] },
                };
              switch (geoType) {
                case "Polygon":
                  feature.geometry.coordinates = [coordinates];
                  break;
                case "Point":
                case "LineString":
                  feature.geometry.coordinates = coordinates;
              }
              (feature.properties = Object.assign(
                feature.properties,
                item.properties
              )),
                featureCollection.features.push(feature);
            }
            return featureCollection;
          },
        },
        {
          key: "transType",
          value: function (plotType) {
            var geoType = "";
            switch (plotType) {
              case "polyline":
                geoType = "LineString";
                break;
              case "polygon":
                geoType = "Polygon";
                break;
              case "point":
              case "gltfModel":
              case "label":
              case "billboard":
                geoType = "Point";
                break;
              default:
                geoType = plotType;
            }
            return geoType;
          },
        },
        {
          key: "destroy",
          value: function () {
            this.nowEditEntityObj &&
              (this.nowEditEntityObj.destroy(),
              (this.nowEditEntityObj = void 0)),
              this.nowDrawEntityObj &&
                (this.nowDrawEntityObj.destroy(),
                (this.nowDrawEntityObj = void 0));
            for (var i = 0; i < this.entityObjArr.length; i++)
              this.entityObjArr[i].destroy();
            (this.entityObjArr = []),
              (this.nowEditEntityObj = void 0),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.removeHandler &&
                (this.removeHandler.destroy(), (this.removeHandler = void 0));
          },
        },
        {
          key: "removeOne",
          value: function (entityObj) {
            entityObj &&
              ("endCreate" != entityObj.state || "endEdit" != entityObj.state
                ? entityObj.destroy()
                : this.removeByObjId(entityObj.objId));
          },
        },
        {
          key: "remove",
          value: function (entityObj) {
            this.removeOne(entityObj);
          },
        },
        {
          key: "removeAll",
          value: function () {
            this.nowDrawEntityObj &&
              (this.nowDrawEntityObj.destroy(),
              (this.nowDrawEntityObj = void 0)),
              this.nowEditEntityObj &&
                (this.nowEditEntityObj.destroy(),
                (this.nowEditEntityObj = void 0));
            for (var i = 0; i < this.entityObjArr.length; i++)
              this.entityObjArr[i].destroy();
            (this.entityObjArr = []), (this.nowEditEntityObj = void 0);
          },
        },
        {
          key: "hasEntityObj",
          value: function (entityObj) {
            return (
              !!entityObj && this.getEntityObjByObjId(entityObj.objId) != {}
            );
          },
        },
        {
          key: "removeByObjId",
          value: function (id) {
            id = this.getEntityObjByObjId(id);
            this.entityObjArr.splice(id.index, 1),
              this.removeFun &&
                this.removeFun(id.entityObj, id.entityObj.getEntity()),
              id.entityObj && id.entityObj.destroy();
          },
        },
        {
          key: "removeById",
          value: function (id) {
            id = this.getEntityObjById(id);
            this.entityObjArr.splice(id.index, 1),
              this.removeFun &&
                this.removeFun(id.entityObj, id.entityObj.getEntity()),
              id.entityObj && id.entityObj.destroy();
          },
        },
        {
          key: "zoomToByObjId",
          value: function (id) {
            id = this.getEntityObjByObjId(id);
            id.entityObj && id.entityObj.zoomTo();
          },
        },
        {
          key: "getEntityObjByField",
          value: function (fieldName, fieldValue) {
            var obj = {};
            if (fieldValue)
              for (var ind = 0; ind < this.entityObjArr.length; ind++) {
                var _item = this.entityObjArr[ind];
                if (_item.attr[fieldName] == fieldValue) {
                  (obj.entityObj = _item), (obj.index = ind);
                  break;
                }
              }
            else
              for (var i = 0; i < this.entityObjArr.length; i++) {
                var item = this.entityObjArr[i];
                if (item.attr.id == fieldName) {
                  (obj.entityObj = item), (obj.index = i);
                  break;
                }
              }
            return obj;
          },
        },
        {
          key: "setVisibleById",
          value: function (id, visible) {
            id = this.getEntityObjByField("id", id);
            id.entityObj && id.entityObj.setVisible(visible);
          },
        },
        {
          key: "setVisible",
          value: function (visible) {
            for (var i = 0; i < this.entityObjArr.length; i++)
              this.entityObjArr[i].setVisible(visible);
          },
        },
        {
          key: "getEntityObjByObjId",
          value: function (id) {
            if (id) {
              for (var obj = {}, i = 0; i < this.entityObjArr.length; i++) {
                var item = this.entityObjArr[i];
                if (item.objId == id) {
                  (obj.entityObj = item), (obj.index = i);
                  break;
                }
              }
              return obj;
            }
          },
        },
        {
          key: "getEntityObjById",
          value: function (id) {
            if (id) {
              for (var obj = {}, i = 0; i < this.entityObjArr.length; i++) {
                var item = this.entityObjArr[i];
                if (item.attr.id == id) {
                  (obj.entityObj = item), (obj.index = i);
                  break;
                }
              }
              return obj;
            }
          },
        },
        {
          key: "bindRemove",
          value: function () {
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                var pick, entObj;
                that.canRemove &&
                  that.canEdit &&
                  !that.nowDrawEntityObj &&
                  (pick = that.viewer.scene.pick(evt.position)) &&
                  pick.id &&
                  pick.id.objId &&
                  (entObj = that.getEntityObjByObjId(
                    pick.id.objId
                  ).entityObj) &&
                  entObj.attr.plotId == that.plotId &&
                  that.createDelteDom(evt.position, pick.id.objId);
              }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
          },
        },
        {
          key: "createDelteDom",
          value: function (px, objId) {
            var deleteDom, clsBtn, that;
            objId &&
              (((deleteDom =
                window.document.createElement("span")).style.background =
                "rgba(0,0,0,0.5)"),
              (deleteDom.style.position = "absolute"),
              (deleteDom.style.color = "white"),
              (deleteDom.style.left = px.x + 10 + "px"),
              (deleteDom.style.top = px.y + 10 + "px"),
              (deleteDom.style.padding = "4px"),
              (deleteDom.style.cursor = "pointer"),
              (deleteDom.id = "vis3d-plot-delete"),
              deleteDom.setAttribute("objId", objId),
              (deleteDom.innerHTML = "删除"),
              window.document
                .getElementById(this.viewer.container.id)
                .appendChild(deleteDom),
              (clsBtn = window.document.getElementById("vis3d-plot-delete")) &&
                ((that = this),
                clsBtn.addEventListener("click", function (e) {
                  var id = deleteDom.getAttribute("objId");
                  that.removeByObjId(id);
                }),
                document.addEventListener("click", function () {
                  clsBtn.remove();
                })));
          },
        },
        {
          key: "endEdit",
          value: function () {
            this.nowEditEntityObj &&
              (this.nowEditEntityObj.endEdit(),
              this.endEditFun &&
                this.endEditFun(
                  this.nowEditEntityObj,
                  this.nowEditEntityObj.getEntity()
                ),
              (this.nowEditEntityObj = void 0));
            for (var i = 0; i < this.entityObjArr.length; i++)
              this.entityObjArr[i].endEdit();
          },
        },
        {
          key: "done",
          value: function () {
            this.nowEditEntityObj &&
              (this.nowEditEntityObj.done(),
              this.endEditFun &&
                this.endEditFun(
                  this.nowEditEntityObj,
                  this.nowEditEntityObj.getEntity()
                ),
              (this.nowEditEntityObj = void 0)),
              this.nowDrawEntityObj &&
                (this.nowDrawEntityObj.done(),
                this.entityObjArr.push(this.nowDrawEntityObj),
                this.endCreateFun &&
                  this.endCreateFun(
                    this.nowDrawEntityObj,
                    this.nowDrawEntityObj.getEntity()
                  ),
                (this.nowDrawEntityObj = void 0));
          },
        },
        {
          key: "getEntityObjArr",
          value: function () {
            return this.entityObjArr;
          },
        },
        {
          key: "createByType",
          value: function (opt) {
            var entityObj = void 0,
              name = "";
            if (
              ("polyline" == (opt = opt || {}).type &&
                ((entityObj = new CreatePolyline(this.viewer, opt)),
                (name = "折线_")),
              "polygon" == opt.type &&
                ((entityObj = new CreatePolygon(this.viewer, opt)),
                (name = "面_")),
              "billboard" == opt.type &&
                ((entityObj = new CreateBillboard(this.viewer, opt)),
                (name = "图标_")),
              "circle" == opt.type &&
                ((entityObj = new CreateCircle(this.viewer, opt)),
                (name = "圆_")),
              "rectangle" == opt.type &&
                ((entityObj = new CreateRectangle(this.viewer, opt)),
                (name = "矩形_")),
              "gltfModel" == opt.type &&
                ((entityObj = new CreateGltfModel(this.viewer, opt)),
                (name = "模型_")),
              "point" == opt.type &&
                ((entityObj = new CreatePoint(this.viewer, opt)),
                (name = "点_")),
              "label" == opt.type &&
                ((entityObj = new CreateLabel(this.viewer, opt)),
                (name = "文字_")),
              "arrow" == opt.type)
            ) {
              if (!opt.arrowType) return void console.log("缺少军事标绘类型");
              entityObj = new CreateArrow(this.viewer, opt);
            }
            return (
              entityObj && (entityObj.name = name + new Date().getTime()),
              entityObj
            );
          },
        },
      ]),
      DrawTool
    );
  })(),
  styleList = [
    { name: "点", type: "point", styleType: "point" },
    {
      name: "线",
      type: "polyline",
      styleType: "polyline",
      style: { clampToGround: !0, color: "#ffff00" },
    },
    {
      name: "面",
      type: "polygon",
      styleType: "polygon",
      style: {
        color: "#0000ff",
        outline: !0,
        outlineColor: "#ff0000",
        heightReference: 1,
      },
    },
    {
      name: "圆形",
      type: "circle",
      styleType: "polygon",
      style: {
        color: "#0000ff",
        colorAlpha: 0.3,
        outline: !0,
        outlineColor: "#ff0000",
        heightReference: 1,
      },
    },
    {
      name: "矩形",
      type: "rectangle",
      styleType: "polygon",
      style: {
        color: "#0000ff",
        outline: !0,
        outlineColor: "#ff0000",
        heightReference: 1,
      },
    },
    {
      name: "图标",
      type: "billboard",
      style: { image: "./vis3d/images/plot/start.png", heightReference: 1 },
      styleType: "billboard",
    },
    {
      name: "文字",
      type: "label",
      style: {
        text: "未命名",
        fillColor: "#fff",
        outline: !1,
        outlineWidth: 1,
        outlineColor: "#ff0000",
        heightReference: 0,
        showBackground: !0,
        backgroundColor: "#000",
        scale: 1,
      },
      styleType: "label",
    },
    {
      name: "动态线",
      type: "polyline",
      styleType: "polyline",
      style: {
        clampToGround: !0,
        color: "#0EFCDC",
        animateType: "flowline",
        duration: 1e3,
        image: "./vis3d/images/texture/glow.png",
      },
    },
    {
      name: "流动线",
      type: "polyline",
      styleType: "polyline",
      style: {
        clampToGround: !0,
        color: "#F9F507",
        animateType: "flowline",
        duration: 1e3,
        image: "./vis3d/images/texture/water.png",
      },
    },
  ],
  drawTool = void 0,
  pviewer = void 0,
  start = function (opt, viewer) {
    drawTool ||
      ((pviewer = viewer || window.viewer),
      (drawTool = new DrawTool(pviewer, { canEdit: !1 })));
    viewer =
      (null ==
      (viewer = styleList.filter(function (item) {
        return item.type == opt.type;
      })[0])
        ? void 0
        : viewer.style) || {};
    return (opt.style = Object.assign(viewer, opt.style)), drawTool.start(opt);
  },
  removeAll = function () {
    drawTool && drawTool.removeAll();
  },
  remove = function (entObj) {
    entObj && drawTool && drawTool.removeOne(entObj);
  },
  draw = Object.freeze({
    __proto__: null,
    start: start,
    removeAll: removeAll,
    remove: remove,
  }),
  BaseLayer = (function () {
    function BaseLayer(viewer, opt) {
      _classCallCheck(this, BaseLayer),
        (this.viewer = viewer),
        (this.opt = opt || {});
      var layerAttrs = [
        "alpha",
        "nightAlpha",
        "dayAlpha",
        "brightness",
        "contrast",
        "hue",
        "saturation",
        "gamma",
        "show",
        "maximumAnisotropy",
        "minimumTerrainLevel",
        "maximumTerrainLevel",
        "colorToAlpha",
        "colorToAlphaThreshold",
      ];
      if (
        ((this.id =
          opt.id ||
          Number(
            new Date().getTime() + "" + Number(1e3 * Math.random()).toFixed(0)
          )),
        opt.url ||
          "tdt" == opt.type ||
          "grid" == opt.type ||
          "tencent" == opt.type ||
          "baidu" == opt.type)
      ) {
        (this.providerAttr = {}),
          (this.imageryLayerAttr = {}),
          this.opt.rectangle &&
            ((viewer = new Cesium.Rectangle(
              Cesium.Math.toRadians(this.opt.rectangle[0]),
              Cesium.Math.toRadians(this.opt.rectangle[1]),
              Cesium.Math.toRadians(this.opt.rectangle[2]),
              Cesium.Math.toRadians(this.opt.rectangle[3])
            )),
            (this.providerAttr.rectangle = viewer),
            (this.imageryLayerAttr.rectangle = viewer));
        for (
          var viewer = new Cesium.WebMercatorTilingScheme(),
            optFields =
              (("EPSG:4326" != opt.srs && "epsg:4326" != opt.srs) ||
                (viewer = new Cesium.GeographicTilingScheme({
                  numberOfLevelZeroTilesX: opt.numberOfLevelZeroTilesX || 2,
                  numberOfLevelZeroTilesY: opt.numberOfLevelZeroTilesY || 1,
                })),
              (this.providerAttr.tilingScheme = viewer),
              (this.providerAttr.url = opt.url),
              Object.keys(this.opt)),
            ind = 0;
          ind < optFields.length;
          ind++
        ) {
          var field = optFields[ind];
          "rectangle" != field &&
            (-1 == layerAttrs.indexOf(field)
              ? (this.providerAttr[field] = this.opt[field])
              : (this.imageryLayerAttr[field] = this.opt[field]));
        }
        (this._layer = void 0), (this._provider = {});
      } else console.log("缺少服务地址！", opt);
    }
    return (
      _createClass(BaseLayer, [
        {
          key: "layer",
          get: function () {
            return this._layer;
          },
        },
        {
          key: "load",
          value: function () {
            this._provider &&
              this._provider != {} &&
              ((this._layer = new Cesium.ImageryLayer(
                this._provider,
                this.imageryLayerAttr
              )),
              this.viewer.imageryLayers.add(this._layer),
              (this._layer.attr = this.opt));
          },
        },
        {
          key: "getLayer",
          value: function () {
            return this._layer;
          },
        },
        {
          key: "remove",
          value: function () {
            this._layer && this.viewer.imageryLayers.remove(this._layer);
          },
        },
        {
          key: "show",
          value: function () {
            this._layer &&
              ((this._layer.show = !0), (this._layer.attr.show = !0));
          },
        },
        {
          key: "hide",
          value: function () {
            this._layer &&
              ((this._layer.show = !1), (this._layer.attr.show = !1));
          },
        },
        {
          key: "setVisible",
          value: function (visible) {
            (visible = null == visible || visible) ? this.show() : this.hide();
          },
        },
        {
          key: "zoomTo",
          value: function () {
            this.opt.view
              ? util$1.setCameraView(this.opt.view)
              : "3dtiles" == this._layer.type &&
                this.viewer.zoomTo(this._layer);
          },
        },
        {
          key: "setAlpha",
          value: function (alpha) {
            this._layer &&
              (this._layer.alpha = alpha = null == alpha ? 1 : alpha);
          },
        },
        {
          key: "lowerLayer",
          value: function () {
            this._layer && this.viewer.imageryLayers.lower(this._layer);
          },
        },
        {
          key: "lowerLayerToBottom",
          value: function () {
            this._layer && this.viewer.imageryLayers.lowerToBottom(this._layer);
          },
        },
        {
          key: "raiseLayer",
          value: function () {
            this._layer && this.viewer.imageryLayers.raise(this._layer);
          },
        },
        {
          key: "raiselayerToTop",
          value: function () {
            this._layer && this.viewer.imageryLayers.raiseToTop(this._layer);
          },
        },
      ]),
      BaseLayer
    );
  })(),
  ArcgiscacheLayer = (function () {
    _inherits(ArcgiscacheLayer, BaseLayer);
    var _super = _createSuper(ArcgiscacheLayer);
    function ArcgiscacheLayer(viewer, opt) {
      _classCallCheck(this, ArcgiscacheLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "arcgiscache"),
        Cesium.UrlTemplateImageryProvider.prototype.padLeft0 ||
          (Cesium.UrlTemplateImageryProvider.prototype.padLeft0 = function (
            numStr,
            n
          ) {
            for (var len = (numStr = String(numStr)).length; len < n; )
              (numStr = "0" + numStr), len++;
            return numStr;
          });
      opt = Object.assign(viewer.providerAttr, {
        customTags: {
          arc_x: function (imageryProvider, x, y, level) {
            return imageryProvider.padLeft0(x.toString(16), 8);
          },
          arc_y: function (imageryProvider, x, y, level) {
            return imageryProvider.padLeft0(y.toString(16), 8);
          },
          arc_z: function (imageryProvider, x, y, level) {
            return imageryProvider.padLeft0(level.toString(), 2);
          },
          arc_z4490: function (imageryProvider, x, y, level) {
            return imageryProvider.padLeft0((level + 1).toString(), 2);
          },
          arc_X: function (imageryProvider, x, y, level) {
            return imageryProvider.padLeft0(x.toString(16), 8).toUpperCase();
          },
          arc_Y: function (imageryProvider, x, y, level) {
            return imageryProvider.padLeft0(y.toString(16), 8).toUpperCase();
          },
          arc_Z: function (imageryProvider, x, y, level) {
            return imageryProvider.padLeft0(level.toString(), 2).toUpperCase();
          },
          arc_Z4490: function (imageryProvider, x, y, level) {
            return imageryProvider
              .padLeft0((level + 1).toString(), 2)
              .toUpperCase();
          },
        },
      });
      return (
        (viewer._provider = new Cesium.UrlTemplateImageryProvider(opt)), viewer
      );
    }
    return _createClass(ArcgiscacheLayer);
  })(),
  MapserverLayer = (function () {
    _inherits(MapserverLayer, BaseLayer);
    var _super = _createSuper(MapserverLayer);
    function MapserverLayer(viewer, opt) {
      return (
        _classCallCheck(this, MapserverLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "mapserver"),
        (viewer._provider = Cesium.ArcGisMapServerImageryProvider.fromUrl(
          viewer.providerAttr.url,
          viewer.providerAttr
        )),
        viewer
      );
    }
    return (
      _createClass(MapserverLayer, [
        {
          key: "load",
          value: function () {
            this._provider &&
              this._provider != {} &&
              ((this._layer = Cesium.ImageryLayer.fromProviderAsync(
                this._provider,
                this.imageryLayerAttr
              )),
              this.viewer.imageryLayers.add(this._layer),
              (this._layer.attr = this.opt));
          },
        },
      ]),
      MapserverLayer
    );
  })(),
  GridLayer = (function () {
    _inherits(GridLayer, BaseLayer);
    var _super = _createSuper(GridLayer);
    function GridLayer(viewer, opt) {
      _classCallCheck(this, GridLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "grid");
      var color = Cesium.Color.fromCssColorString(opt.color || "#33FFFF"),
        glowColor = Cesium.Color.fromCssColorString(opt.glowColor || "#33FFFF"),
        backgroundColor = Cesium.Color.fromCssColorString(
          opt.backgroundColor || "#CCCCCC"
        );
      return (
        (viewer.providerAttr.cells = opt.cells || 4),
        (viewer.providerAttr.glowWidth = opt.glowWidth || 3),
        (viewer.providerAttr.color = color),
        (viewer.providerAttr.glowColor = glowColor),
        (viewer.providerAttr.backgroundColor = backgroundColor),
        (viewer._provider = new Cesium.GridImageryProvider(
          viewer.providerAttr
        )),
        viewer
      );
    }
    return _createClass(GridLayer);
  })(),
  defaulteStyle = {
    point: {
      color: "#00FFFF",
      colorAlpha: 1,
      outlineWidth: 1,
      outlineColor: "#00FFFF",
      outlineColorAlpha: 1,
      pixelSize: 20,
      heightReference: 1,
      disableDepthTestDistance: Number.MAX_VALUE,
    },
    polyline: { color: "#FFFF00", colorAlpha: 1, width: 3, clampToGround: 1 },
    polygon: {
      heightReference: 1,
      fill: !0,
      color: "#00FFFF",
      colorAlpha: 1,
      outline: !0,
      outlineWidth: 1,
      outlineColor: "#FFFF00",
      outlineColorAlpha: 1,
    },
    label: {
      fillColor: "#ffffff",
      fillColorAlpah: 1,
      disableDepthTestDistance: Number.MAX_VALUE,
      heightReference: 1,
      showBackground: !1,
      backgroundColor: "#000000",
      backgroundColorAlpha: 0.5,
      outlineColor: "#C6A300",
      outlineColorAlpha: 1,
      outlineWidth: 1,
      pixelOffset: [0, -20],
      font: "14px",
      verticalOrigin: 1,
      HorizontalOrigin: 0,
    },
  },
  transColor = function (color, alpha) {
    return (
      (alpha = alpha || 1),
      color instanceof Cesium.Color
        ? color.clone()
        : Cesium.Color.fromCssColorString(color).withAlpha(alpha)
    );
  },
  transC2 = function (arr) {
    return (arr = arr || [0, 0]), new Cesium.Cartesian2(arr[0], arr[1]);
  },
  setPointStyle = function (ent, style) {
    if (ent) {
      var i,
        point = ent.point;
      for (i in (((style = Object.assign(defaulteStyle.point, style)).color =
        transColor(style.color, style.colorAlpha)),
      (style.outlineColor = transColor(
        style.outlineColor,
        style.outlineColorAlpha
      )),
      style))
        point[i] = style[i];
    }
  },
  setLabelStyle = function (ent, style) {
    if (ent) {
      var i,
        label = ent.label;
      for (i in (((style = Object.assign(
        defaulteStyle.label,
        style
      )).fillColor = style.color || style.fillColor),
      (style.fillColor = transColor(style.fillColor, style.fillColorAlpah)),
      (style.outlineColor = transColor(
        style.outlineColor,
        style.outlineColorAlpha
      )),
      style.showBackground &&
        (style.backgroundColor = transColor(
          style.backgroundColor,
          style.backgroundColorAlpha
        )),
      (style.pixelOffset = transC2(style.pixelOffset)),
      style))
        label[i] = style[i];
    }
  },
  setPolylineStyle = function (ent, style) {
    if (ent) {
      var i,
        polyline = ent.polyline;
      for (i in (((style = Object.assign(defaulteStyle.polyline, style)).color =
        transColor(style.color, style.colorAlpha)),
      (style.material = style.color.clone()),
      style))
        polyline[i] = style[i];
    }
  },
  setPolygonStyle = function (ent, style) {
    if (ent) {
      var i,
        polygon = ent.polygon;
      for (i in (((style = Object.assign(defaulteStyle.polygon, style)).color =
        transColor(style.color, style.colorAlpha)),
      (style.material = style.color.clone()),
      1 == style.heightReference && (style.height = void 0),
      style))
        polygon[i] = style[i];
    }
  },
  GeojsonLayer = (function (_BaseLayer) {
    _inherits(GeojsonLayer, _BaseLayer);
    var _super = _createSuper(GeojsonLayer);
    function GeojsonLayer(viewer, opt) {
      _classCallCheck(this, GeojsonLayer),
        ((_this = _super.call(this, viewer, opt)).type = "geojson"),
        (_this.viewer = viewer),
        (_this.opt = opt || {});
      var _this,
        i,
        defaultStyleVal = {
          point: {
            color: "#00FFFF",
            colorAlpha: 1,
            outlineWidth: 1,
            outlineColor: "#00FFFF",
            outlineColorAlpha: 1,
            pixelSize: 14,
            heightReference: 1,
            disableDepthTestDistance: Number.MAX_VALUE,
          },
          polyline: {
            color: "#FFFF00",
            colorAlpha: 1,
            width: 3,
            clampToGround: 1,
          },
          polygon: {
            heightReference: 1,
            fill: !0,
            color: "#00FFFF",
            colorAlpha: 1,
            outline: !0,
            outlineWidth: 1,
            outlineColor: "#FFFF00",
            outlineColorAlpha: 1,
          },
          label: {
            text: "--",
            fillColor: "#ffffff",
            disableDepthTestDistance: Number.MAX_VALUE,
            heightReference: 1,
            showBackground: !1,
            verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
            outlineColor: "#00FFFF",
            outlineWidth: 1,
          },
        };
      for (i in ((_this.featureStyle = opt.style), opt.style)) {
        var feastyle = opt.style[i];
        _this.featureStyle[i] = Object.assign(defaultStyleVal[i], feastyle);
      }
      return (_this.url = _this.opt.url || ""), _this;
    }
    return (
      _createClass(GeojsonLayer, [
        {
          key: "load",
          value: function (fun) {
            var _this2 = this,
              that = this;
            this.viewer.dataSources
              .add(Cesium.GeoJsonDataSource.load(this.url))
              .then(function (ds) {
                (that._layer = ds), (that._layer.attr = that.opt);
                for (
                  var i = that._layer.entities.values.length - 1;
                  0 <= i;
                  i--
                ) {
                  var newPointStyle,
                    pointStyle,
                    position,
                    newLineStyle,
                    newPolygonStyle,
                    ent = that._layer.entities.values[i],
                    _ent$properties =
                      (null == (_ent$properties = ent.properties)
                        ? void 0
                        : _ent$properties.getValue(
                            that.viewer.clock.currentTime
                          )) || {};
                  ent.billboard
                    ? ((position = ent.position.getValue(
                        that.viewer.clock.currentTime
                      )),
                      that.featureStyle.point &&
                        ((pointStyle = that.featureStyle.point),
                        ((newPointStyle = JSON.parse(
                          JSON.stringify(pointStyle)
                        )).color = that.getColorByProperty(
                          pointStyle.color,
                          _ent$properties
                        )),
                        (pointStyle = that._layer.entities.add({
                          position: position,
                          point: {},
                        })),
                        setPointStyle(pointStyle, newPointStyle),
                        that.opt.tooltip &&
                          that.bindTooltip(
                            pointStyle,
                            that.opt.tooltip,
                            _ent$properties
                          )),
                      _this2.featureStyle.label &&
                        ((newPointStyle = that.featureStyle.label),
                        ((newPointStyle = JSON.parse(
                          JSON.stringify(newPointStyle)
                        )).text = _this2.featureStyle.label.text.field
                          ? _ent$properties[
                              _this2.featureStyle.label.text.field
                            ]
                          : _this2.featureStyle.label.text),
                        (pointStyle = that._layer.entities.add({
                          position: position,
                          label: { text: "----" },
                        })),
                        setLabelStyle(pointStyle, newPointStyle)),
                      that._layer.entities.remove(ent))
                    : (ent.polyline
                        ? ((position = that.featureStyle.polyline),
                          ((newLineStyle = JSON.parse(
                            JSON.stringify(position)
                          )).color = that.getColorByProperty(
                            position.color,
                            _ent$properties
                          )),
                          setPolylineStyle(ent, newLineStyle))
                        : ent.polygon &&
                          ((newLineStyle = that.featureStyle.polygon),
                          ((newPolygonStyle = JSON.parse(
                            JSON.stringify(newLineStyle)
                          )).color = that.getColorByProperty(
                            newLineStyle.color,
                            _ent$properties
                          )),
                          setPolygonStyle(ent, newPolygonStyle)),
                      that.opt.tooltip &&
                        that.bindTooltip(
                          ent,
                          that.opt.tooltip,
                          _ent$properties
                        ));
                }
                that.opt.flyTo && that.zoomTo(), fun && fun();
              });
          },
        },
        {
          key: "bindTooltip",
          value: function (ent, tooltipObj, properties) {
            var content;
            ent &&
              ((content = ""),
              "string" == typeof tooltipObj
                ? (content = tooltipObj)
                : tooltipObj instanceof Array &&
                  tooltipObj.forEach(function (item) {
                    var field = item.field,
                      item = item.fieldName;
                    content += ""
                      .concat(item, "：")
                      .concat(properties[field], "<br/>");
                  }),
              (ent.tooltip = content));
          },
        },
        {
          key: "getColorByProperty",
          value: function (colorObj, properties) {
            var field;
            return "random" == (colorObj = colorObj || "#ff0000")
              ? this.getRandomColor()
              : "string" == typeof colorObj
              ? colorObj
              : ((field = colorObj.field),
                colorObj.conditions instanceof Array
                  ? this.getConditionValue(
                      field,
                      properties[field],
                      colorObj.conditions
                    )
                  : this.getRandomColor());
          },
        },
        {
          key: "getConditionValue",
          value: function getConditionValue(key, value, conditions) {
            for (
              var styleValue = void 0, ind = 0;
              ind < conditions.length;
              ind++
            )
              if ("true" == conditions[ind][0]) {
                styleValue = conditions[ind][1];
                break;
              }
            for (var i = 0; i < conditions.length; i++) {
              var condition = conditions[i],
                replaceStr = "${" + key + "}",
                str = condition[0].replace(replaceStr, '"' + value + '"');
              if (eval(str)) {
                styleValue = condition[1];
                break;
              }
            }
            return styleValue;
          },
        },
        {
          key: "getEntityField",
          value: function (field, value) {
            for (
              var _ent$properties2, i = 0;
              i < this._layer.entities.length;
              i++
            )
              if (
                ((null ==
                (_ent$properties2 = this._layer.entities[i].properties)
                  ? void 0
                  : _ent$properties2.getValue(that.viewer.clock.currentTime)) ||
                  {})[field] == value
              )
                break;
          },
        },
        {
          key: "zoomTo",
          value: function () {
            this._layer &&
              (this._layer.attr.view
                ? util$1.setCameraView(opt.view)
                : this.viewer.zoomTo(this._layer));
          },
        },
        {
          key: "remove",
          value: function () {
            this._layer && this.viewer.dataSources.remove(this._layer);
          },
        },
        {
          key: "show",
          value: function () {
            this._layer &&
              ((this._layer.show = !0), (this._layer.attr.show = !0));
          },
        },
        {
          key: "hide",
          value: function () {
            this._layer &&
              ((this._layer.attr.show = !1), (this._layer.show = !1));
          },
        },
        {
          key: "destroy",
          value: function () {
            this._layer &&
              (this._layer.entities.removeAll(),
              this.viewer.dataSources.remove(this._layer));
          },
        },
        {
          key: "getContent",
          value: function (properties, fields) {
            for (var html = "", i = 0; i < fields.length; i++) {
              var _fields$i = fields[i],
                field = _fields$i.field,
                _fields$i = _fields$i.fieldName,
                field = properties[field];
              html += "\n                <tr>\n                    <td>"
                .concat(_fields$i, "：</td>\n                    <td>")
                .concat(field, "</td>\n                </tr>\n            ");
            }
            return "\n            <table>".concat(html, "</table>\n        ");
          },
        },
        {
          key: "getRandomColor",
          value: function () {
            for (
              var color = "#",
                arr = [
                  "0",
                  "1",
                  "2",
                  "3",
                  "4",
                  "5",
                  "6",
                  "7",
                  "8",
                  "9",
                  "A",
                  "B",
                  "C",
                  "D",
                  "E",
                  "F",
                ],
                i = 0;
              i < 6;
              i++
            )
              color += arr[parseInt(16 * Math.random())];
            return color;
          },
        },
      ]),
      GeojsonLayer
    );
  })(BaseLayer),
  TDTLayer = (function () {
    _inherits(TDTLayer, BaseLayer);
    var _super = _createSuper(TDTLayer);
    function TDTLayer(viewer, opt) {
      _classCallCheck(this, TDTLayer);
      var keys = [
          "313cd4b28ed520472e8b43de00b2de56",
          "83b36ded6b43b9bc81fbf617c40b83b5",
          "0ebd57f93a114d146a954da4ecae1e67",
          "6c99c7793f41fccc4bd595b03711913e",
          "56b81006f361f6406d0e940d2f89a39c",
        ],
        viewer = _super.call(this, viewer, opt);
      if (
        ((viewer.type = "tdt"),
        (viewer.opt = opt || {}),
        viewer.opt.keys && 0 != viewer.opt.keys.length
          ? Array.isArray(viewer.opt.keys)
            ? ((opt = Math.random() * viewer.opt.key.length),
              (opt = Math.floor(opt)),
              (viewer.key = keys[opt]))
            : (viewer.key = viewer.opt.keys)
          : ((opt = Math.random() * keys.length),
            (opt = Math.floor(opt)),
            (viewer.key = keys[opt])),
        !viewer.opt.layerName)
      )
        return console.log("缺少图层名称"), _possibleConstructorReturn(viewer);
      for (
        var keys = "",
          opt = "",
          url =
            "https://t{s}.tianditu.gov.cn/" +
            (opt =
              4326 == viewer.opt.crs
                ? ((keys = "c"), viewer.opt.layerName + "_c")
                : ((keys = "w"), viewer.opt.layerName + "_w")) +
            "/wmts?service=WMTS&version=1.0.0&request=GetTile&tilematrix={TileMatrix}&layer=" +
            viewer.opt.layerName +
            "&style={style}&tilerow={TileRow}&tilecol={TileCol}&tilematrixset={TileMatrixSet}&format=tiles&tk=" +
            viewer.key,
          tileMatrixLabels = [],
          z = 0;
        z <= 18;
        z++
      )
        tileMatrixLabels[z] = z.toString();
      (url = {
        url: url,
        layer: opt,
        style: "default",
        format: "tiles",
        tileMatrixSetID: keys,
        subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
        tileMatrixLabels: tileMatrixLabels,
        tilingScheme: new Cesium.WebMercatorTilingScheme(),
      }),
        (url = Object.assign(viewer.providerAttr || {}, url));
      return (
        (viewer._provider = new Cesium.WebMapTileServiceImageryProvider(url)),
        viewer
      );
    }
    return _createClass(TDTLayer);
  })(),
  SingleImageLayer = (function () {
    _inherits(SingleImageLayer, BaseLayer);
    var _super = _createSuper(SingleImageLayer);
    function SingleImageLayer(viewer, opt) {
      return (
        _classCallCheck(this, SingleImageLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "singleImage"),
        (viewer.providerAttr.tileWidth = viewer.providerAttr.tileWidth || 256),
        (viewer.providerAttr.tileHeight = viewer.providerAttr.tileWidth || 256),
        (viewer._provider = new Cesium.SingleTileImageryProvider(
          viewer.providerAttr
        )),
        viewer
      );
    }
    return _createClass(SingleImageLayer);
  })(),
  TMSLayer = (function () {
    _inherits(TMSLayer, BaseLayer);
    var _super = _createSuper(TMSLayer);
    function TMSLayer(viewer, opt) {
      return (
        _classCallCheck(this, TMSLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "tms"),
        (viewer._provider = new Cesium.TileMapServiceImageryProvider(
          viewer.opt
        )),
        viewer
      );
    }
    return _createClass(TMSLayer);
  })(),
  XYZLayer = (function () {
    _inherits(XYZLayer, BaseLayer);
    var _super = _createSuper(XYZLayer);
    function XYZLayer(viewer, opt) {
      return (
        _classCallCheck(this, XYZLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "xyz"),
        (viewer._provider = new Cesium.UrlTemplateImageryProvider(
          viewer.providerAttr
        )),
        viewer
      );
    }
    return (
      _createClass(XYZLayer, [
        {
          key: "layer",
          get: function () {
            return this._layer;
          },
        },
        {
          key: "provider",
          get: function () {
            return this._provider;
          },
        },
      ]),
      XYZLayer
    );
  })(),
  TilesetEdit = (function () {
    function TilesetEdit(viewer, opt) {
      _classCallCheck(this, TilesetEdit),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.tileset = opt.tileset),
        opt.tileset
          ? ((this.initTransform = this.tileset._root.transform.clone()),
            (this.initTransform_inverse = Cesium.Matrix4.inverse(
              this.initTransform.clone(),
              new Cesium.Matrix4()
            )),
            (viewer = Cesium.Transforms.eastNorthUpToFixedFrame(
              this.tileset.boundingSphere.center.clone()
            )),
            (this.centerMtx_inverse = Cesium.Matrix4.inverse(
              viewer.clone(),
              new Cesium.Matrix4()
            )),
            (this.newCenter = Cesium.Matrix4.multiplyByPoint(
              this.centerMtx_inverse.clone(),
              this.tileset.boundingSphere.center.clone(),
              new Cesium.Cartesian3()
            )),
            (this.rotate = {
              xMatrix: void 0,
              yMatrix: void 0,
              zMatrix: void 0,
            }),
            (this.scale = {
              xMatrix: void 0,
              yMatrix: void 0,
              zMatrix: void 0,
            }),
            (this.hprMatrix = void 0),
            (this.translation = void 0),
            (this.centerPosition = this.tileset.boundingSphere.center.clone()))
          : console.log("缺少模型！");
    }
    return (
      _createClass(TilesetEdit, [
        {
          key: "setPosition",
          value: function (position) {
            position instanceof Cesium.Cartesian3 ||
              (position = Cesium.Cartesian3.fromDegrees(
                Number(position[0]),
                Number(position[1]),
                Number(position[2] || 0)
              )),
              (this.centerPosition = position.clone());
            (position = Cesium.Matrix4.multiplyByPoint(
              this.centerMtx_inverse.clone(),
              position.clone(),
              new Cesium.Cartesian3()
            )),
              (position = Cesium.Cartesian3.subtract(
                position.clone(),
                this.newCenter.clone(),
                new Cesium.Cartesian3()
              ));
            (this.translation = position.clone()), this.update();
          },
        },
        {
          key: "update",
          value: function () {
            var nowMovelMtx;
            (this.tileset._root.transform = this.initTransform.clone()),
              this.translation &&
                ((nowMovelMtx = Cesium.Matrix4.fromTranslation(
                  this.translation.clone(),
                  new Cesium.Matrix4()
                )),
                Cesium.Matrix4.multiply(
                  this.tileset._root.transform,
                  nowMovelMtx.clone(),
                  this.tileset._root.transform
                )),
              this.rotate.xMatrix &&
                ((nowMovelMtx = Cesium.Matrix4.fromRotation(
                  this.rotate.xMatrix,
                  new Cesium.Matrix4()
                )),
                Cesium.Matrix4.multiply(
                  this.tileset._root.transform,
                  nowMovelMtx.clone(),
                  this.tileset._root.transform
                )),
              this.rotate.yMatrix &&
                ((nowMovelMtx = Cesium.Matrix4.fromRotation(
                  this.rotate.yMatrix,
                  new Cesium.Matrix4()
                )),
                Cesium.Matrix4.multiply(
                  this.tileset._root.transform,
                  nowMovelMtx.clone(),
                  this.tileset._root.transform
                )),
              this.rotate.zMatrix &&
                ((nowMovelMtx = Cesium.Matrix4.fromRotation(
                  this.rotate.zMatrix,
                  new Cesium.Matrix4()
                )),
                Cesium.Matrix4.multiply(
                  this.tileset._root.transform,
                  nowMovelMtx.clone(),
                  this.tileset._root.transform
                )),
              this.hprMatrix &&
                Cesium.Matrix4.multiply(
                  this.tileset._root.transform,
                  this.hprMatrix.clone(),
                  this.tileset._root.transform
                ),
              this.scale.xMatrix &&
                Cesium.Matrix4.multiply(
                  this.tileset._root.transform,
                  this.scale.xMatrix.clone(),
                  this.tileset._root.transform
                ),
              this.scale.yMatrix &&
                Cesium.Matrix4.multiply(
                  this.tileset._root.transform,
                  this.scale.yMatrix.clone(),
                  this.tileset._root.transform
                ),
              this.scale.zMatrix &&
                Cesium.Matrix4.multiply(
                  this.tileset._root.transform,
                  this.scale.zMatrix.clone(),
                  this.tileset._root.transform
                );
          },
        },
        {
          key: "setScale",
          value: function (scale) {
            this.setScaleX(scale), this.setScaleY(scale), this.setScaleZ(scale);
          },
        },
        {
          key: "setScaleX",
          value: function (sc) {
            (sc = new Cesium.Cartesian3(sc, 1, 1)),
              (sc = Cesium.Matrix4.fromScale(sc.clone(), new Cesium.Matrix4()));
            (this.scale.xMatrix = sc.clone()), this.update();
          },
        },
        {
          key: "setScaleY",
          value: function (sc) {
            (sc = new Cesium.Cartesian3(1, sc, 1)),
              (sc = Cesium.Matrix4.fromScale(sc.clone(), new Cesium.Matrix4()));
            (this.scale.yMatrix = sc.clone()), this.update();
          },
        },
        {
          key: "setScaleZ",
          value: function (sc) {
            (sc = new Cesium.Cartesian3(1, 1, sc)),
              (sc = Cesium.Matrix4.fromScale(sc.clone(), new Cesium.Matrix4()));
            (this.scale.zMatrix = sc.clone()), this.update();
          },
        },
        {
          key: "setRotateX",
          value: function (angle) {
            console.log("edit x==>", angle);
            angle = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(angle));
            (this.rotate.xMatrix = angle.clone()), this.update();
          },
        },
        {
          key: "setRotateY",
          value: function (angle) {
            console.log("edit y==>", angle);
            angle = Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(angle));
            (this.rotate.yMatrix = angle.clone()), this.update();
          },
        },
        {
          key: "setRotateZ",
          value: function (angle) {
            var rotation = Cesium.Matrix3.fromRotationZ(
              Cesium.Math.toRadians(angle)
            );
            console.log("edit z==>", angle),
              (this.rotate.zMatrix = rotation.clone()),
              this.update();
          },
        },
        {
          key: "reset",
          value: function () {
            (this.tileset._root.transform = this.initTransform.clone()),
              (this.rotate = {
                xMatrix: void 0,
                yMatrix: void 0,
                zMatrix: void 0,
              }),
              (this.scale = {
                xMatrix: void 0,
                yMatrix: void 0,
                zMatrix: void 0,
              }),
              (this.hprMatrix = void 0),
              (this.translation = void 0);
          },
        },
      ]),
      TilesetEdit
    );
  })(),
  TilesetLayer = (function () {
    function TilesetLayer(viewer, opt) {
      _classCallCheck(this, TilesetLayer),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.type = "3dtiles"),
        this.opt.url || console.log("缺少服务地址！", opt),
        (this._layer = void 0),
        (this.tilesetEdit = void 0);
    }
    var _load;
    return (
      _createClass(TilesetLayer, [
        {
          key: "layer",
          get: function () {
            return this._layer;
          },
        },
        {
          key: "load",
          value:
            ((_load = _asyncToGenerator(
              _regeneratorRuntime().mark(function _callee(fun) {
                var defaultVal;
                return _regeneratorRuntime().wrap(
                  function (_context) {
                    for (;;)
                      switch ((_context.prev = _context.next)) {
                        case 0:
                          return (
                            (defaultVal = {
                              maximumScreenSpaceError: 16,
                              skipLevelOfDetail: !0,
                              preferLeaves: !0,
                              maximumMemoryUsage: 512,
                            }),
                            (defaultVal = Object.assign(defaultVal, this.opt)),
                            (_context.next = 4),
                            Cesium.Cesium3DTileset.fromUrl(
                              defaultVal.url,
                              defaultVal
                            )
                          );
                        case 4:
                          return (
                            (defaultVal = _context.sent),
                            this.viewer.scene.primitives.add(defaultVal),
                            this.tilesetEdit ||
                              (this.tilesetEdit = new TilesetEdit(this.viewer, {
                                tileset: defaultVal,
                              })),
                            (this._layer = defaultVal),
                            (this._layer.layerConfig = this.opt),
                            (this._layer.initBoundingSphere =
                              defaultVal.boundingSphere.clone()),
                            (this._layer.show =
                              null == this.opt.show || this.opt.show),
                            this.opt.center && this.setCenter(this.opt.center),
                            this.opt.orientation &&
                              this.setOrientation(this.opt.orientation),
                            this.opt.scale && this.setScale(this.opt.scale),
                            this.opt.flyTo && this.zoomTo(),
                            this.opt.style && this.updateStyle(this.opt.style),
                            fun && fun(defaultVal),
                            _context.abrupt("return", defaultVal)
                          );
                        case 18:
                        case "end":
                          return _context.stop();
                      }
                  },
                  _callee,
                  this
                );
              })
            )),
            function (_x) {
              return _load.apply(this, arguments);
            }),
        },
        {
          key: "destroy",
          value: function () {
            this._layer && this.viewer.scene.primitives.remove(this._layer),
              (this._layer = void 0);
          },
        },
        {
          key: "remove",
          value: function () {
            this._layer && this.viewer.scene.primitives.remove(this._layer);
          },
        },
        {
          key: "show",
          value: function () {
            this._layer &&
              ((this._layer.show = !0),
              (this._layer.layerConfig.show = !0),
              this.opt.style && this.updateStyle(this.opt.style));
          },
        },
        {
          key: "hide",
          value: function () {
            this._layer &&
              ((this._layer.show = !1), (this._layer.layerConfig.show = !1));
          },
        },
        {
          key: "setVisible",
          value: function (visible) {
            visible ? this.show() : this.hide();
          },
        },
        {
          key: "zoomTo",
          value: function () {
            this._layer &&
              (this._layer.layerConfig.view
                ? util$1.setCameraView(this.opt.view)
                : this.viewer.flyTo(
                    this._layer,
                    new Cesium.HeadingPitchRange(
                      Cesium.Math.toRadians(0),
                      Cesium.Math.toRadians(-60),
                      5 * this._layer.boundingSphere.radius
                    )
                  ));
          },
        },
        {
          key: "setCenter",
          value: function (opt) {
            var origin;
            (opt = opt || {}) instanceof Cesium.Cartesian3
              ? this.tilesetEdit.setPosition(opt.clone())
              : ((origin = Cesium.Cartographic.fromCartesian(
                  this._layer.boundingSphere.center
                )),
                (opt.x = opt.x || Cesium.Math.toDegrees(origin.longitude)),
                (opt.y = opt.y || Cesium.Math.toDegrees(origin.latitude)),
                this.tilesetEdit.setPosition([opt.x, opt.y, opt.z]));
          },
        },
        {
          key: "setOrientation",
          value: function (opt) {
            var heading, pitch;
            opt &&
              ((heading = (opt = opt || {}).heading),
              (pitch = opt.pitch),
              (opt = opt.roll),
              null != heading && this.tilesetEdit.setRotateZ(heading),
              null != pitch && this.tilesetEdit.setRotateY(pitch),
              null != opt && this.tilesetEdit.setRotateX(opt));
          },
        },
        {
          key: "setScale",
          value: function (opt) {
            var x, y, _ref2;
            opt &&
              (isNaN(opt)
                ? ((x = (_ref2 = opt || {}).x),
                  (y = _ref2.y),
                  (_ref2 = _ref2.z),
                  null != x && this.tilesetEdit.setScaleX(x),
                  null != y && this.tilesetEdit.setScaleY(y),
                  null != _ref2 && this.tilesetEdit.setScaleZ(_ref2))
                : this.tilesetEdit.setScale(Number(opt)));
          },
        },
        {
          key: "updateStyle",
          value: function (style) {
            style && (this._layer.style = new Cesium.Cesium3DTileStyle(style));
          },
        },
        {
          key: "setAlpha",
          value: function (alpha) {
            (alpha = null == alpha ? 1 : alpha),
              (this._layer.style = new Cesium.Cesium3DTileStyle({
                color: "color('rgba(255,255,255," + alpha + ")')",
              }));
          },
        },
      ]),
      TilesetLayer
    );
  })(),
  WMSLayer = (function () {
    _inherits(WMSLayer, BaseLayer);
    var _super = _createSuper(WMSLayer);
    function WMSLayer(viewer, opt) {
      return (
        _classCallCheck(this, WMSLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "wms"),
        viewer.providerAttr.layers ||
          console.log("当前服务缺少 layers 参数！", viewer.providerAttr),
        (viewer._provider = new Cesium.WebMapServiceImageryProvider(
          viewer.providerAttr
        )),
        viewer
      );
    }
    return _createClass(WMSLayer);
  })(),
  WMTSLayer = (function () {
    _inherits(WMTSLayer, BaseLayer);
    var _super = _createSuper(WMTSLayer);
    function WMTSLayer(viewer, opt) {
      return (
        _classCallCheck(this, WMTSLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "wmts"),
        viewer.providerAttr.layers ||
          console.log("当前服务缺少 layers 参数！", viewer.providerAttr),
        (viewer._provider = new Cesium.WebMapTileServiceImageryProvider(
          viewer.providerAttr
        )),
        viewer
      );
    }
    return _createClass(WMTSLayer);
  })(),
  UrltemplateLayer = (function () {
    _inherits(UrltemplateLayer, BaseLayer);
    var _super = _createSuper(UrltemplateLayer);
    function UrltemplateLayer(viewer, opt) {
      return (
        _classCallCheck(this, UrltemplateLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "mapserver"),
        (viewer._provider = new Cesium.UrlTemplateImageryProvider(
          viewer.providerAttr
        )),
        viewer
      );
    }
    return _createClass(UrltemplateLayer);
  })();
function BaiduImageryProvider(options) {
  (this._errorEvent = new Cesium.Event()),
    (this._tileWidth = 256),
    (this._tileHeight = 256),
    (this._maximumLevel = 18),
    (this._minimumLevel = 1);
  var southwestInMeters = new Cesium.Cartesian2(-33554054, -33746824),
    northeastInMeters = new Cesium.Cartesian2(33554054, 33746824),
    southwestInMeters =
      ((this._tilingScheme = new Cesium.WebMercatorTilingScheme({
        rectangleSouthwestInMeters: southwestInMeters,
        rectangleNortheastInMeters: northeastInMeters,
      })),
      (this._rectangle = this._tilingScheme.rectangle),
      Cesium.Resource.createIfNeeded(options.url));
  (this._resource = southwestInMeters),
    (this._tileDiscardPolicy = void 0),
    (this._credit = void 0),
    (this._readyPromise = void 0);
}
Object.defineProperties(BaiduImageryProvider.prototype, {
  url: {
    get: function () {
      return this._resource.url;
    },
  },
  proxy: {
    get: function () {
      return this._resource.proxy;
    },
  },
  tileWidth: {
    get: function () {
      if (this.ready) return this._tileWidth;
      throw new Cesium.DeveloperError(
        "tileWidth must not be called before the imagery provider is ready."
      );
    },
  },
  tileHeight: {
    get: function () {
      if (this.ready) return this._tileHeight;
      throw new Cesium.DeveloperError(
        "tileHeight must not be called before the imagery provider is ready."
      );
    },
  },
  maximumLevel: {
    get: function () {
      if (this.ready) return this._maximumLevel;
      throw new Cesium.DeveloperError(
        "maximumLevel must not be called before the imagery provider is ready."
      );
    },
  },
  minimumLevel: {
    get: function () {
      if (this.ready) return this._minimumLevel;
      throw new Cesium.DeveloperError(
        "minimumLevel must not be called before the imagery provider is ready."
      );
    },
  },
  tilingScheme: {
    get: function () {
      if (this.ready) return this._tilingScheme;
      throw new Cesium.DeveloperError(
        "tilingScheme must not be called before the imagery provider is ready."
      );
    },
  },
  tileDiscardPolicy: {
    get: function () {
      if (this.ready) return this._tileDiscardPolicy;
      throw new Cesium.DeveloperError(
        "tileDiscardPolicy must not be called before the imagery provider is ready."
      );
    },
  },
  rectangle: {
    get: function () {
      if (this.ready) return this._rectangle;
      throw new Cesium.DeveloperError(
        "rectangle must not be called before the imagery provider is ready."
      );
    },
  },
  errorEvent: {
    get: function () {
      return this._errorEvent;
    },
  },
  ready: {
    get: function () {
      return this._resource;
    },
  },
  readyPromise: {
    get: function () {
      return this._readyPromise;
    },
  },
  credit: {
    get: function () {
      if (this.ready) return this._credit;
      throw new Cesium.DeveloperError(
        "credit must not be called before the imagery provider is ready."
      );
    },
  },
}),
  (BaiduImageryProvider.prototype.requestImage = function (
    x,
    y,
    level,
    request
  ) {
    var r = this._tilingScheme.getNumberOfXTilesAtLevel(level),
      c = this._tilingScheme.getNumberOfYTilesAtLevel(level),
      x = this.url
        .replace("{x}", x - r / 2)
        .replace("{y}", c / 2 - y - 1)
        .replace("{z}", level)
        .replace("{s}", Math.floor(10 * Math.random()));
    return Cesium.ImageryProvider.loadImage(this, x);
  });
var BaiduLayer = (function () {
    _inherits(BaiduLayer, BaseLayer);
    var _super = _createSuper(BaiduLayer);
    function BaiduLayer(viewer, opt) {
      _classCallCheck(this, BaiduLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "baidu");
      opt = Object.assign(viewer.providerAttr || {}, {
        url: "http://online{s}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles=pl&scaler=1&p=1",
      });
      return (viewer._provider = new BaiduImageryProvider(opt)), viewer;
    }
    return _createClass(BaiduLayer);
  })(),
  TencentLayer = (function () {
    _inherits(TencentLayer, BaseLayer);
    var _super = _createSuper(TencentLayer);
    function TencentLayer(viewer, opt) {
      _classCallCheck(this, TencentLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "tencent");
      (opt = {
        url: viewer.getUrlByType(opt.layerType || "1"),
        customTags: {
          sx: function (imageryProvider, x, y, level) {
            return x >> 4;
          },
          sy: function (imageryProvider, x, y, level) {
            return ((1 << level) - y) >> 4;
          },
        },
      }),
        (opt = Object.assign(viewer.providerAttr || {}, opt));
      return (
        (viewer._provider = new Cesium.UrlTemplateImageryProvider(opt)), viewer
      );
    }
    return (
      _createClass(TencentLayer, [
        {
          key: "getUrlByType",
          value: function (type) {
            var url = "";
            switch (type) {
              case "1":
                url =
                  "https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400";
                break;
              case "2":
                url =
                  "https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=1&version=297";
                break;
              case "3":
                url =
                  "https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=4&scene=0";
                break;
              case "4":
                url =
                  "https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=3&scene=0";
                break;
              case "5":
                url =
                  "https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=2&version=297";
            }
            return url;
          },
        },
      ]),
      TencentLayer
    );
  })(),
  OSMLayer = (function () {
    _inherits(OSMLayer, BaseLayer);
    var _super = _createSuper(OSMLayer);
    function OSMLayer(viewer, opt) {
      _classCallCheck(this, OSMLayer),
        ((viewer = _super.call(this, viewer, opt)).type = "osm");
      opt = Object.assign(viewer.providerAttr || {}, {
        subdomains: ["a", "b", "c", "d"],
      });
      return (
        (viewer._provider = new Cesium.UrlTemplateImageryProvider(opt)), viewer
      );
    }
    return _createClass(OSMLayer);
  })(),
  LayerTool = (function () {
    function LayerTool(viewer, opt) {
      _classCallCheck(this, LayerTool),
        (this.viewer = viewer),
        (this._layerObjs = []);
    }
    return (
      _createClass(LayerTool, [
        {
          key: "layerObjs",
          get: function () {
            return this._layerObjs;
          },
        },
        {
          key: "add",
          value: function (opt) {
            var layerObj = void 0,
              success = opt.success;
            switch ((opt = JSON.parse(JSON.stringify(opt || {}))).type) {
              case "xyz":
                layerObj = new XYZLayer(this.viewer, opt);
                break;
              case "wfs":
              case "geojson":
                layerObj = new GeojsonLayer(this.viewer, opt);
                break;
              case "mapserver":
                layerObj = new MapserverLayer(this.viewer, opt);
                break;
              case "arcgiscache":
                layerObj = new ArcgiscacheLayer(this.viewer, opt);
                break;
              case "tdt":
                layerObj = new TDTLayer(this.viewer, opt);
                break;
              case "singleImage":
                layerObj = new SingleImageLayer(this.viewer, opt);
                break;
              case "tms":
                layerObj = new TMSLayer(this.viewer, opt);
                break;
              case "3dtiles":
                layerObj = new TilesetLayer(this.viewer, opt);
                break;
              case "wms":
                layerObj = new WMSLayer(this.viewer, opt);
                break;
              case "wmts":
                layerObj = new WMTSLayer(this.viewer, opt);
                break;
              case "grid":
                layerObj = new GridLayer(this.viewer, opt);
                break;
              case "tencent":
                layerObj = new TencentLayer(this.viewer, opt);
                break;
              case "baidu":
                layerObj = new BaiduLayer(this.viewer, opt);
                break;
              case "osm":
                layerObj = new OSMLayer(this.viewer, opt);
                break;
              case "urltemplate":
                layerObj = new UrltemplateLayer(this.viewer, opt);
            }
            if (layerObj)
              return (
                "3dtiles" == layerObj.type || "geojson" == layerObj.type
                  ? layerObj.load(function (layer) {
                      null != opt.alpha && layerObj.setAlpha(opt.alpha),
                        layerObj.setVisible(null == opt.show || opt.show),
                        success && success(layerObj, layer);
                    })
                  : (layerObj.load(),
                    null != opt.alpha && layerObj.setAlpha(opt.alpha),
                    layerObj.setVisible(null == opt.show || opt.show),
                    success && success(layerObj, layerObj.layer)),
                this._layerObjs.push(layerObj),
                (opt.id =
                  opt.id ||
                  Number(
                    new Date().getTime() +
                      "" +
                      Number(1e3 * Math.random()).toFixed(0)
                  )),
                (opt.alpha = null == opt.alpha ? 1 : opt.alpha),
                (layerObj.attr = opt),
                layerObj
              );
          },
        },
        {
          key: "getLayerObjById",
          value: function (id) {
            if (id) {
              for (var obj = {}, i = 0; i < this._layerObjs.length; i++)
                if (this._layerObjs[i].attr.id == id) {
                  obj = { layerObj: this._layerObjs[i], index: i };
                  break;
                }
              return obj;
            }
          },
        },
        {
          key: "getLayerObjByObjId",
          value: function (id) {
            if (id) {
              for (var obj = {}, i = 0; i < this._layerObjs.length; i++)
                if (this._layerObjs[i].objId == id) {
                  obj = { layerObj: this._layerObjs[i], index: i };
                  break;
                }
              return obj;
            }
          },
        },
        {
          key: "removeLayerObj",
          value: function (layerObj) {
            layerObj && this.removeLayerObjById(layerObj.id);
          },
        },
        {
          key: "removeLayerObjById",
          value: function (id) {
            !id ||
              ((id = this.getLayerObjById(id)) &&
                id.layerObj &&
                (id.layerObj.remove(), this._layerObjs.splice(id.index, 1)));
          },
        },
        {
          key: "removeAll",
          value: function () {
            for (var i = 0; i < this._layerObjs.length; i++)
              this._layerObjs[i].remove();
            this._layerObjs = [];
          },
        },
        {
          key: "destroy",
          value: function () {
            this.removeAll(), (this._layerObjs = []), delete this._layerObjs;
          },
        },
        {
          key: "hideById",
          value: function (id) {
            !id ||
              ((id = this.getLayerObjById(id)) &&
                id.layerObj &&
                (id.layerObj.hide(), (id.layerObj.attr.show = !1)));
          },
        },
        {
          key: "showById",
          value: function (id) {
            !id ||
              ((id = this.getLayerObjById(id)) &&
                id.layerObj &&
                (id.layerObj.show(), (id.layerObj.attr.show = !0)));
          },
        },
        {
          key: "setVisible",
          value: function (id, isShow) {
            id && (isShow ? this.showById(id) : this.hideById(id));
          },
        },
        {
          key: "zoomTo",
          value: function (id) {
            !id ||
              ((id = this.getLayerObjById(id) || {}) &&
                id.layerObj &&
                id.layerObj.zoomTo());
          },
        },
        {
          key: "hideAll",
          value: function () {
            for (var i = 0; i < this._layerObjs.length; i++)
              this._layerObjs[i].hide();
          },
        },
        {
          key: "getAllshow",
          value: function () {
            for (var arr = [], i = 0; i < this._layerObjs.length; i++)
              this._layerObjs[i].attr.show && arr.push(this._layerObjs[i]);
            return arr;
          },
        },
        {
          key: "getAllhide",
          value: function () {
            for (var arr = [], i = 0; i < this._layerObjs.length; i++)
              this._layerObjs[i].attr.show || arr.push(this._layerObjs[i]);
            return arr;
          },
        },
        {
          key: "getLayerObjByField",
          value: function (field, val) {
            if (field) {
              for (var returnData = [], i = 0; i < this._layerObjs.length; i++)
                this._layerObjs[i].attr[field] == val &&
                  returnData.push(this._layerObjs[i]);
              return returnData;
            }
          },
        },
      ]),
      LayerTool
    );
  })(),
  layerTool = void 0,
  add = function (opt, viewer) {
    return (layerTool = layerTool || new LayerTool(viewer)).add(opt);
  },
  remove$1 = function (layerObj) {
    layerObj && layerTool && layerTool.removeLayerObj(layerObj);
  },
  removeAll$1 = function () {
    layerObj && layerTool.removeAll();
  },
  layerload = Object.freeze({
    __proto__: null,
    add: add,
    remove: remove$1,
    removeAll: removeAll$1,
  }),
  BaseMeasure = (function () {
    function BaseMeasure(viewer, opt) {
      _classCallCheck(this, BaseMeasure),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.objId = Number(
          new Date().getTime() + "" + Number(1e3 * Math.random()).toFixed(0)
        )),
        (this.state = void 0),
        (this.handler = new Cesium.ScreenSpaceEventHandler(
          this.viewer.scene.canvas
        )),
        (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
          this.viewer.scene.canvas
        )),
        (this.floatLable = void 0),
        (this.unit = opt.unit),
        (this.controlPoints = []),
        (this.pointStyle = {}),
        (this.modifyPoint = void 0),
        (this.promptStyle = opt.prompt || {
          show: !0,
          offset: { x: 20, y: 20 },
        }),
        (this.scale = this.opt.scale || [1, 1]);
    }
    return (
      _createClass(BaseMeasure, [
        { key: "endCreate", value: function () {} },
        { key: "done", value: function () {} },
        {
          key: "createLine",
          value: function (positions, clampToGround) {
            if (positions)
              return this.viewer.entities.add({
                polyline: {
                  positions: new Cesium.CallbackProperty(function () {
                    return positions;
                  }, !1),
                  show: !0,
                  material: new Cesium.PolylineOutlineMaterialProperty({
                    color: Cesium.Color.GOLD,
                    outlineWidth: 1,
                    outlineColor: Cesium.Color.BLACK,
                  }),
                  disableDepthTestDistance: Number.POSITIVE_INFINITY,
                  width: 3,
                  clampToGround: clampToGround,
                },
              });
          },
        },
        {
          key: "forbidDrawWorld",
          value: function (isForbid) {
            (this.viewer.scene.screenSpaceCameraController.enableRotate =
              !isForbid),
              (this.viewer.scene.screenSpaceCameraController.enableTilt =
                !isForbid),
              (this.viewer.scene.screenSpaceCameraController.enableTranslate =
                !isForbid),
              (this.viewer.scene.screenSpaceCameraController.enableInputs =
                !isForbid);
          },
        },
        {
          key: "createLabel",
          value: function (c, text) {
            if (c)
              return this.viewer.entities.add({
                position: c,
                label: {
                  text: text || "",
                  font: "18px Helvetica",
                  fillColor: Cesium.Color.WHITE,
                  outlineColor: Cesium.Color.BLACK,
                  outlineWidth: 2,
                  disableDepthTestDistance: Number.POSITIVE_INFINITY,
                  style: Cesium.LabelStyle.FILL_AND_OUTLINE,
                  pixelOffset: new Cesium.Cartesian2(0, -20),
                },
              });
          },
        },
        {
          key: "setUnit",
          value: function (unit) {
            unit && (this.unit = unit);
          },
        },
        {
          key: "getAzimuthtAndCenter",
          value: function (mtx, positions) {
            var center;
            if (positions && !(positions.length < 2))
              return (
                (center = positions[0].clone()),
                (mtx =
                  mtx ||
                  Cesium.Transforms.eastNorthUpToFixedFrame(center.clone())),
                (mtx = Cesium.Matrix4.inverse(mtx, new Cesium.Matrix4())),
                (positions = positions[1].clone()),
                (center = Cesium.Matrix4.multiplyByPoint(
                  mtx,
                  center,
                  new Cesium.Cartesian3()
                )),
                (positions = Cesium.Matrix4.multiplyByPoint(
                  mtx,
                  positions,
                  new Cesium.Cartesian3()
                )),
                (mtx = Cesium.Cartesian3.subtract(
                  positions,
                  center,
                  new Cesium.Cartesian3()
                )),
                (mtx = Cesium.Cartesian3.normalize(
                  mtx,
                  new Cesium.Cartesian3()
                )),
                (center = new Cesium.Cartesian3(0, 1, 0)),
                (center = Cesium.Cartesian3.dot(center, mtx)),
                (mtx = new Cesium.Cartesian3(1, 0, 0)),
                (mtx = Cesium.Cartesian3.dot(mtx, positions)),
                (positions = Math.acos(center)),
                (center = Cesium.Math.toDegrees(positions)),
                mtx < 0 ? 360 - center : center
              );
          },
        },
        {
          key: "formateLength",
          value: function (val, dw) {
            var dwStr;
            if (null != val)
              return (
                (dwStr = ""),
                "km" == (dw = dw || "m") || "千米" == dw
                  ? (dwStr += (Number(val) / 1e3).toFixed(2) + "km")
                  : ("m" != dw && "米" != dw) ||
                    (dwStr += Number(val).toFixed(2) + "m"),
                dwStr
              );
          },
        },
        {
          key: "formateArea",
          value: function (val, dw) {
            var dwStr;
            if (null != val)
              return (
                (dwStr = ""),
                "km" == (dw = dw || "m") || "平方千米" == dw
                  ? (dwStr += (Number(val) / 1e6).toFixed(2) + "km²")
                  : ("m" != dw && "米" != dw && "平方米" != dw) ||
                    (dwStr += Number(val).toFixed(2) + "m²"),
                dwStr
              );
          },
        },
        {
          key: "getCatesian3FromPX",
          value: function (px, viewer) {
            if (px) {
              (px.x = px.x / this.scale[0]), (px.y = px.y / this.scale[1]);
              for (
                var cartesian,
                  picks = viewer.scene.drillPick(px),
                  isOn3dtiles = (viewer.scene.render(), !1),
                  i = 0;
                i < picks.length;
                i++
              )
                if (
                  picks[i] &&
                  picks[i].primitive &&
                  picks[i].primitive instanceof Cesium.Cesium3DTileset
                ) {
                  isOn3dtiles = !0;
                  break;
                }
              if (isOn3dtiles) cartesian = viewer.scene.pickPosition(px);
              else {
                px = viewer.camera.getPickRay(px);
                if (!px) return null;
                cartesian = viewer.scene.globe.pick(px, viewer.scene);
              }
              return cartesian;
            }
          },
        },
        {
          key: "getGroundLength",
          value: function (positions, callback) {
            var ellipsoid = this.viewer.scene.globe.ellipsoid,
              len = this.getLength(positions[0], positions[1]);
            if (this.viewer.terrainProvider.availability) {
              var surfacePositions = Cesium.PolylinePipeline.generateArc({
                positions: positions,
                granularity: 1e-5,
              });
              if (surfacePositions) {
                for (
                  var cartographicArray = [],
                    tempHeight = Cesium.Cartographic.fromCartesian(
                      positions[0]
                    ).height,
                    i = 0;
                  i < surfacePositions.length;
                  i += 3
                ) {
                  var cartesian = Cesium.Cartesian3.unpack(surfacePositions, i);
                  cartographicArray.push(
                    ellipsoid.cartesianToCartographic(cartesian)
                  );
                }
                Cesium.sampleTerrainMostDetailed(
                  this.viewer.terrainProvider,
                  cartographicArray
                ).then(function (updateLnglats) {
                  for (
                    var allLength = 0, _i = 0;
                    _i < updateLnglats.length;
                    _i++
                  ) {
                    var item = updateLnglats[_i];
                    item.height
                      ? (item.height += 10)
                      : (item.height = tempHeight);
                  }
                  for (
                    var raisedPositions =
                        ellipsoid.cartographicArrayToCartesianArray(
                          updateLnglats
                        ),
                      z = 0;
                    z < raisedPositions.length - 1;
                    z++
                  )
                    allLength += Cesium.Cartesian3.distance(
                      raisedPositions[z],
                      raisedPositions[z + 1]
                    );
                  allLength && callback(allLength);
                });
              }
            } else
              console.log("缺少地形数据，或地形加载失败！"),
                callback && callback(len);
          },
        },
        {
          key: "getSlope",
          value: function (center, callback) {
            var centerCtgc, points, ctgcs;
            center &&
              ((centerCtgc = Cesium.Cartographic.fromCartesian(center)),
              (points = util$1.getCirclePointsByRadius({
                center: center,
                radius: 0.5,
                angle: 1,
              })),
              (ctgcs = []),
              points.forEach(function (pt) {
                pt = Cesium.Cartographic.fromCartesian(pt);
                ctgcs.push(pt);
              }),
              Cesium.sampleTerrainMostDetailed(
                this.viewer.terrainProvider,
                ctgcs
              ).then(function (updateLnglats) {
                for (
                  var slop = Number.MAX_VALUE,
                    slopAngle = 0,
                    slopPosition = center.clone(),
                    ind = 0;
                  ind < updateLnglats.length;
                  ind++
                ) {
                  var item = updateLnglats[ind],
                    p = Cesium.Cartographic.toCartesian(item),
                    dis = Cesium.Cartesian3.distance(center.clone(), p.clone()),
                    item = item.height - (centerCtgc.height || 0),
                    disH = Math.sqrt(dis * dis - item * item),
                    item = item / disH,
                    slopAngle = Math.acos(disH / dis);
                  item <= slop && ((slop = item), (slopPosition = p));
                }
                var direction = Cesium.Cartesian3.subtract(
                    slopPosition.clone(),
                    center.clone(),
                    new Cesium.Cartesian3()
                  ),
                  direction = Cesium.Cartesian3.normalize(
                    direction.clone(),
                    direction.clone()
                  );
                callback && callback(direction, slop, slopAngle);
              }));
          },
        },
        {
          key: "getLength",
          value: function (c1, c2) {
            return (c1 && c2 && Cesium.Cartesian3.distance(c1, c2)) || 0;
          },
        },
        {
          key: "getAreaAndCenter",
          value: function (positions) {
            if (positions && !(positions.length < 1)) {
              for (
                var polygon$1,
                  features,
                  cartographics = [],
                  turfPoints = [],
                  i = 0;
                i < positions.length;
                i++
              ) {
                var cartesian3 = positions[i],
                  cartesian3 = Cesium.Cartographic.fromCartesian(cartesian3);
                cartographics.push([
                  Cesium.Math.toDegrees(cartesian3.longitude),
                  Cesium.Math.toDegrees(cartesian3.latitude),
                ]),
                  turfPoints.push(
                    point([
                      Cesium.Math.toDegrees(cartesian3.longitude),
                      Cesium.Math.toDegrees(cartesian3.latitude),
                    ])
                  );
              }
              if (cartographics.length)
                return (
                  (cartographics = cartographics.concat([cartographics[0]])),
                  (polygon$1 = polygon([cartographics])),
                  (polygon$1 = area(polygon$1)),
                  (features = featureCollection(turfPoints)),
                  (features = center(features).geometry.coordinates),
                  {
                    area: polygon$1,
                    center: Cesium.Cartesian3.fromDegrees(
                      features[0],
                      features[1]
                    ),
                  }
                );
            }
          },
        },
        {
          key: "createPoint",
          value: function (position) {
            var color, outlineColor;
            if (position)
              return (
                (this.pointStyle.color =
                  this.pointStyle.color || Cesium.Color.AQUA),
                (this.pointStyle.outlineColor =
                  this.pointStyle.color || Cesium.Color.WHITE),
                (color = (color =
                  this.pointStyle.color instanceof Cesium.Color
                    ? this.pointStyle.color
                    : Cesium.Color.fromCssColorString(
                        this.pointStyle.color
                      )).withAlpha(this.pointStyle.colorAlpha || 0.8)),
                (outlineColor = (outlineColor =
                  this.pointStyle.outlineColor instanceof Cesium.Color
                    ? this.pointStyle.outlineColor
                    : Cesium.Color.fromCssColorString(
                        this.pointStyle.outlineColor
                      )).withAlpha(this.pointStyle.outlineColorAlpha || 0.8)),
                this.viewer.entities.add({
                  position: position,
                  point: {
                    pixelSize: this.pointStyle.pixelSize || 6,
                    color: color,
                    outlineWidth: this.pointStyle.outlineWidth || 1,
                    outlineColor: outlineColor,
                    disableDepthTestDistance: Number.POSITIVE_INFINITY,
                  },
                  show: !1,
                })
              );
          },
        },
        { key: "destroy", value: function () {} },
        { key: "endEdit", value: function () {} },
        { key: "startEdit", value: function () {} },
        { key: "start", value: function () {} },
      ]),
      BaseMeasure
    );
  })(),
  MeasureGroundDistance = (function () {
    _inherits(MeasureGroundDistance, BaseMeasure);
    var _super = _createSuper(MeasureGroundDistance);
    function MeasureGroundDistance(viewer, opt) {
      var _this;
      return (
        _classCallCheck(this, MeasureGroundDistance),
        ((_this = _super.call(this, viewer, opt)).unitType = "length"),
        (_this.unit = opt.unit || "米"),
        (_this.type = "groundDistance"),
        (_this.style = (opt = opt || {}).style || {}),
        (_this.viewer = viewer),
        (_this.polyline = void 0),
        (_this.positions = []),
        (_this.labels = []),
        (_this.nowLabel = void 0),
        (_this.nextlabel = void 0),
        (_this.lastPosition = void 0),
        (_this.nextPosition = void 0),
        (_this.modifyPoint = void 0),
        (_this.lastCartesian = void 0),
        (_this.allDistance = 0),
        _this.prompt,
        (_this.movePush = !1),
        (_this.floatDistance = -1),
        _this
      );
    }
    return (
      _createClass(MeasureGroundDistance, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle));
            var that = this;
            (this.state = "startCreate"),
              this.handler.setInputAction(function (evt) {
                that.state = "creating";
                var label,
                  point,
                  evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  (that.movePush &&
                    (that.positions.pop(), (that.movePush = !1)),
                  that.floatLable ||
                    ((that.floatLable = that.createLabel(evt, "")),
                    (that.floatLable.wz = 0),
                    (that.floatLable.show = !1)),
                  ((label = that.createLabel(evt, "")).wz =
                    that.positions.length),
                  that.labels.push(label),
                  ((point = that.createPoint(evt.clone())).wz =
                    that.positions.length),
                  that.controlPoints.push(point),
                  0 == that.positions.length
                    ? (label.label.text = "起点")
                    : ((that.lastDistance = that.floatDistance),
                      (that.allDistance += that.floatDistance),
                      (point = that.formateLength(that.floatDistance)),
                      (label.label.text = point),
                      (label.distance = that.floatDistance)),
                  that.positions.push(evt.clone()),
                  (that.lastCartesian = evt.clone()));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                var cartesian;
                (that.state = "creating"),
                  that.positions.length < 1
                    ? that.prompt.update(evt.endPosition, "单击开始测量")
                    : (that.prompt.update(
                        evt.endPosition,
                        "双击结束，右键取消上一步"
                      ),
                      (cartesian = that.getCatesian3FromPX(
                        evt.endPosition,
                        that.viewer
                      )) &&
                        (that.movePush
                          ? (that.positions[that.positions.length - 1] =
                              cartesian.clone())
                          : (that.positions.push(cartesian),
                            (that.movePush = !0)),
                        Cesium.defined(that.polyline) ||
                          ((that.polyline = that.createLine(
                            that.positions,
                            !0
                          )),
                          (that.polyline.objId = that.objId)),
                        that.lastCartesian &&
                          that.getGroundLength(
                            [cartesian, that.lastCartesian],
                            function (distance) {
                              (that.floatLable.show = !0),
                                (that.floatLable.label.text =
                                  that.formateLength(distance, that.unit)),
                                that.floatLable.position.setValue(cartesian),
                                (that.floatLable.distance = distance) &&
                                  (that.floatDistance = distance);
                            }
                          )));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.handler.setInputAction(function (evt) {
                var cartesian;
                (that.state = "creating"),
                  !that.polyline ||
                    that.positions.length <= 2 ||
                    (that.positions.splice(that.positions.length - 2, 1),
                    that.viewer.entities.remove(that.labels.pop()),
                    that.viewer.entities.remove(that.controlPoints.pop()),
                    (that.allDistance = that.allDistance - that.lastDistance),
                    1 == that.positions.length &&
                      (that.polyline &&
                        (that.viewer.entities.remove(that.polyline),
                        (that.polyline = void 0)),
                      that.prompt.update(evt.endPosition, "单击开始测量"),
                      (that.floatLable.show = !1),
                      (that.positions = [])),
                    that.movePush
                      ? (that.lastCartesian =
                          that.positions[that.positions.length - 2])
                      : (that.lastCartesian =
                          that.positions[that.positions.length - 1]),
                    (cartesian = that.getCatesian3FromPX(
                      evt.position,
                      that.viewer
                    )) &&
                      that.getGroundLength(
                        [cartesian, that.positions[that.positions.length - 2]],
                        function (distance) {
                          (that.floatLable.show = !0),
                            (that.floatLable.label.text = that.formateLength(
                              distance,
                              that.unit
                            )),
                            (that.floatLable.distance = distance),
                            that.floatLable.position.setValue(cartesian);
                        }
                      ));
              }, Cesium.ScreenSpaceEventType.RIGHT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.positions.pop(),
                  that.viewer.entities.remove(that.labels.pop()),
                  that.viewer.entities.remove(that.controlPoints.pop()),
                  (that.movePush = !1),
                  that.endCreate(),
                  callback && callback();
              }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
          },
        },
        {
          key: "endCreate",
          value: function () {
            var allDistance;
            this.polyline &&
              ((this.floatLable.show = !1),
              this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY),
              (this.viewer.trackedEntity = void 0),
              (allDistance = this.formateLength(this.allDistance, this.unit)),
              (this.labels[this.labels.length - 1].label.text =
                "总长：" + allDistance),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "endCreate"));
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "creating" == this.state
              ? this.positions.length <= 2 && 1 == this.movePush
                ? this.destroy()
                : this.endCreate()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            if (
              ("endCreate" == this.state || "endEdit" == this.state) &&
              this.polyline
            ) {
              (this.state = "startEdit"),
                this.modifyHandler ||
                  (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                    this.viewer.scene.canvas
                  ));
              for (var that = this, i = 0; i < that.controlPoints.length; i++) {
                var point = that.controlPoints[i];
                point && (point.show = !0);
              }
              this.modifyHandler.setInputAction(function (evt) {
                var nextIndex,
                  lastIndex,
                  evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  null != evt.id.wz &&
                  (evt.id.objId || (that.modifyPoint = evt.id),
                  that.forbidDrawWorld(!0),
                  (nextIndex = (evt = that.modifyPoint.wz) + 1),
                  (lastIndex = evt - 1),
                  (that.nowLabel = that.labels[evt]),
                  0 <= lastIndex &&
                    (that.lastPosition = that.positions[lastIndex]),
                  nextIndex <= that.positions.length - 1 &&
                    ((that.nextPosition = that.positions[nextIndex]),
                    (that.nextlabel = that.labels[nextIndex])));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
                this.modifyHandler.setInputAction(function (evt) {
                  var wz, changeDis1, changeDis2;
                  that.positions.length < 1 ||
                    !that.modifyPoint ||
                    ((evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (that.modifyPoint.position.setValue(evt),
                      (wz = that.modifyPoint.wz),
                      (that.positions[wz] = evt.clone()),
                      (that.state = "editing"),
                      that.nowLabel.position.setValue(evt.clone()),
                      (changeDis2 = changeDis1 = 0),
                      that.nowLabel &&
                        that.lastPosition &&
                        that.getGroundLength(
                          [evt.clone(), that.lastPosition.clone()],
                          function (distance) {
                            (that.nowLabel.label.text = that.formateLength(
                              distance,
                              that.unit
                            )),
                              (changeDis1 = distance - that.nowLabel.distance),
                              (that.nowLabel.distance = distance),
                              (that.allDistance =
                                that.allDistance + changeDis1 + changeDis2);
                            distance = that.formateLength(
                              that.allDistance,
                              that.unit
                            );
                            that.labels[that.labels.length - 1].label.text =
                              "总长：" + distance;
                          }
                        ),
                      that.nextPosition &&
                        that.nextlabel &&
                        that.getGroundLength(
                          [evt.clone(), that.nextPosition.clone()],
                          function (distance) {
                            (that.nextlabel.label.text = that.formateLength(
                              distance,
                              that.unit
                            )),
                              (changeDis2 = distance - that.nextlabel.distance),
                              (that.nextlabel.distance = distance),
                              (that.allDistance =
                                that.allDistance + changeDis1 + changeDis2);
                            distance = that.formateLength(
                              that.allDistance,
                              that.unit
                            );
                            that.labels[that.labels.length - 1].label.text =
                              "总长：" + distance;
                          }
                        )));
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
                this.modifyHandler.setInputAction(function (evt) {
                  that.modifyPoint &&
                    ((that.modifyPoint = void 0),
                    (that.lastPosition = void 0),
                    (that.nextPosition = void 0),
                    that.forbidDrawWorld(!1),
                    callback && callback(),
                    (that.state = "endEdit"));
                }, Cesium.ScreenSpaceEventType.LEFT_UP);
            }
          },
        },
        {
          key: "endEdit",
          value: function () {
            (this.state = "endEdit"),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              point && (point.show = !1);
            }
          },
        },
        {
          key: "destroy",
          value: function () {
            this.polyline &&
              (this.viewer.entities.remove(this.polyline),
              (this.polyline = void 0));
            for (var i = 0; i < this.labels.length; i++)
              this.viewer.entities.remove(this.labels[i]);
            this.labels = [];
            for (var ind = 0; ind < this.controlPoints.length; ind++)
              this.viewer.entities.remove(this.controlPoints[ind]);
            (this.controlPoints = []),
              (this.modifyPoint = void 0),
              this.floatLable &&
                (this.viewer.entities.remove(this.floatLable),
                (this.floatLable = void 0)),
              (this.floatLable = void 0),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY),
              (this.viewer.trackedEntity = void 0),
              (this.state = "no");
          },
        },
        {
          key: "setUnit",
          value: function (unit) {
            for (var i = 1; i < this.labels.length; i++) {
              var labelEnt = this.labels[i],
                distance = labelEnt.distance,
                labelEnt = labelEnt.label;
              labelEnt &&
                (i == this.labels.length - 1
                  ? (labelEnt.text =
                      "总长：" + this.formateLength(distance, unit))
                  : (labelEnt.text = this.formateLength(distance, unit)));
            }
            this.unit = unit;
          },
        },
      ]),
      MeasureGroundDistance
    );
  })(),
  MeasureSpaceDistance = (function () {
    _inherits(MeasureSpaceDistance, BaseMeasure);
    var _super = _createSuper(MeasureSpaceDistance);
    function MeasureSpaceDistance(viewer, opt) {
      return (
        _classCallCheck(this, MeasureSpaceDistance),
        ((viewer = _super.call(this, viewer, opt)).unitType = "length"),
        (viewer.type = "spaceDistance"),
        (viewer.unit = opt.unit || "米"),
        (viewer.allDistance = 0),
        (viewer.labels = []),
        (viewer.positions = []),
        (viewer.polyline = void 0),
        (viewer.nowLabel = void 0),
        (viewer.nextlabel = void 0),
        (viewer.lastPosition = void 0),
        (viewer.nextPosition = void 0),
        viewer
      );
    }
    return (
      _createClass(MeasureSpaceDistance, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle));
            var that = this;
            (this.state = "startCreate"),
              this.handler.setInputAction(function (evt) {
                that.state = "creating";
                var distance,
                  label,
                  text,
                  evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  (that.movePush &&
                    (that.positions.pop(), (that.movePush = !1)),
                  0 == that.positions.length
                    ? ((label = that.createLabel(evt, "起点")),
                      (that.floatLable = that.createLabel(evt, "")),
                      (that.floatLable.wz = 0),
                      (that.floatLable.show = !1))
                    : ((distance = that.getLength(evt, that.lastCartesian)),
                      (that.lastDistance = distance),
                      (that.allDistance += distance),
                      (text = that.formateLength(distance, that.unit)),
                      ((label = that.createLabel(evt, text)).wz =
                        that.positions.length),
                      (label.distance = distance)),
                  that.labels.push(label),
                  ((text = that.createPoint(evt.clone())).wz =
                    that.positions.length),
                  that.controlPoints.push(text),
                  that.positions.push(evt),
                  (that.lastCartesian = evt.clone()));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                var cartesian = that.getCatesian3FromPX(
                  evt.endPosition,
                  that.viewer
                );
                cartesian &&
                  ((that.state = "creating"),
                  that.positions.length < 1
                    ? that.prompt.update(evt.endPosition, "单击开始测量")
                    : (that.prompt.update(
                        evt.endPosition,
                        "双击结束，右键取消上一步"
                      ),
                      (that.floatLable.show = !0),
                      that.movePush
                        ? (that.positions[that.positions.length - 1] =
                            cartesian)
                        : (that.positions.push(cartesian),
                          (that.movePush = !0)),
                      Cesium.defined(that.polyline) ||
                        ((that.polyline = that.createLine(that.positions, !1)),
                        (that.polyline.objId = that.objId)),
                      that.lastCartesian &&
                        ((evt = that.getLength(cartesian, that.lastCartesian)),
                        (that.floatLable.show = !0),
                        (that.floatLable.label.text = that.formateLength(
                          evt,
                          that.unit
                        )),
                        (that.floatLable.distance = evt),
                        that.floatLable.position.setValue(cartesian))));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.handler.setInputAction(function (evt) {
                var distance;
                (that.state = "creating"),
                  !that.polyline ||
                    that.positions.length <= 2 ||
                    (that.positions.splice(that.positions.length - 2, 1),
                    that.viewer.entities.remove(that.labels.pop()),
                    that.viewer.entities.remove(that.controlPoints.pop()),
                    (that.allDistance = that.allDistance - that.lastDistance),
                    1 == that.positions.length &&
                      (that.polyline &&
                        (that.viewer.entities.remove(that.polyline),
                        (that.polyline = void 0)),
                      that.prompt.update(evt.endPosition, "单击开始测量"),
                      (that.movePush = !1),
                      (that.floatLable.show = !1),
                      (that.positions = [])),
                    (evt = that.getCatesian3FromPX(
                      evt.position,
                      that.viewer
                    )) &&
                      ((distance = that.getLength(
                        evt,
                        that.positions[that.positions.length - 2]
                      )),
                      (that.floatLable.show = !0),
                      (that.floatLable.label.text = that.formateLength(
                        distance,
                        that.unit
                      )),
                      (that.floatLable.distance = distance),
                      that.floatLable.position.setValue(evt),
                      that.movePush
                        ? (that.lastCartesian =
                            that.positions[that.positions.length - 2])
                        : (that.lastCartesian =
                            that.positions[that.positions.length - 1])));
              }, Cesium.ScreenSpaceEventType.RIGHT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.polyline &&
                  (that.positions.pop(),
                  that.viewer.entities.remove(that.labels.pop()),
                  that.viewer.entities.remove(that.controlPoints.pop()),
                  (that.movePush = !1),
                  that.endCreate(),
                  callback && callback());
              }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
          },
        },
        {
          key: "endCreate",
          value: function () {
            var allDistance;
            this.polyline &&
              ((this.floatLable.show = !1),
              this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY),
              (this.viewer.trackedEntity = void 0),
              (allDistance = this.formateLength(this.allDistance, this.unit)),
              (this.labels[this.labels.length - 1].label.text =
                "总长：" + allDistance),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              (this.state = "endCreate"));
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "creating" == this.state
              ? this.positions.length <= 2 && 1 == this.movePush
                ? this.destroy()
                : this.endCreate()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            if ("endCreate" == this.state || "endEdit" == this.state) {
              (this.state = "startEdit"),
                this.modifyHandler ||
                  (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                    this.viewer.scene.canvas
                  ));
              for (var that = this, i = 0; i < that.controlPoints.length; i++) {
                var point = that.controlPoints[i];
                point && (point.show = !0);
              }
              this.modifyHandler.setInputAction(function (evt) {
                var nextIndex,
                  lastIndex,
                  evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  null != evt.id.wz &&
                  (evt.id.objId || (that.modifyPoint = evt.id),
                  that.forbidDrawWorld(!0),
                  (nextIndex = (evt = that.modifyPoint.wz) + 1),
                  (lastIndex = evt - 1),
                  (that.nowLabel = that.labels[evt]),
                  0 <= lastIndex &&
                    (that.lastPosition = that.positions[lastIndex]),
                  nextIndex <= that.positions.length - 1 &&
                    ((that.nextPosition = that.positions[nextIndex]),
                    (that.nextlabel = that.labels[nextIndex])));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
                this.modifyHandler.setInputAction(function (evt) {
                  var wz, distance;
                  that.positions.length < 1 ||
                    !that.modifyPoint ||
                    ((evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (that.modifyPoint.position.setValue(evt),
                      (wz = that.modifyPoint.wz),
                      (that.positions[wz] = evt.clone()),
                      (that.state = "editing"),
                      that.nowLabel.position.setValue(evt.clone()),
                      (wz = 0),
                      that.nowLabel &&
                        that.lastPosition &&
                        ((distance = that.getLength(
                          evt.clone(),
                          that.lastPosition.clone()
                        )),
                        (that.nowLabel.label.text = that.formateLength(
                          distance,
                          that.unit
                        )),
                        (wz = distance - that.nowLabel.distance),
                        (that.nowLabel.distance = distance)),
                      (distance = 0),
                      that.nextPosition &&
                        that.nextlabel &&
                        ((evt = that.getLength(
                          evt.clone(),
                          that.nextPosition.clone()
                        )),
                        (that.nextlabel.label.text = that.formateLength(
                          evt,
                          that.unit
                        )),
                        (distance = evt - that.nextlabel.distance),
                        (that.nextlabel.distance = evt)),
                      (that.allDistance = that.allDistance + wz + distance),
                      (evt = that.formateLength(that.allDistance, that.unit)),
                      (that.labels[that.labels.length - 1].label.text =
                        "总长：" + evt)));
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
                this.modifyHandler.setInputAction(function (evt) {
                  that.modifyPoint &&
                    ((that.modifyPoint = void 0),
                    (that.lastPosition = void 0),
                    (that.nextPosition = void 0),
                    that.forbidDrawWorld(!1),
                    callback && callback(),
                    (that.state = "endEdit"));
                }, Cesium.ScreenSpaceEventType.LEFT_UP);
            }
          },
        },
        {
          key: "endEdit",
          value: function () {
            (this.state = "endEdit"),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              point && (point.show = !1);
            }
          },
        },
        {
          key: "destroy",
          value: function () {
            this.polyline &&
              (this.viewer.entities.remove(this.polyline),
              (this.polyline = void 0));
            for (var i = 0; i < this.labels.length; i++)
              this.viewer.entities.remove(this.labels[i]);
            this.labels = [];
            for (var ind = 0; ind < this.controlPoints.length; ind++)
              this.viewer.entities.remove(this.controlPoints[ind]);
            (this.controlPoints = []),
              (this.modifyPoint = void 0),
              this.floatLable &&
                (this.viewer.entities.remove(this.floatLable),
                (this.floatLable = void 0)),
              (this.floatLable = void 0),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              (this.movePush = !1),
              this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY),
              (this.viewer.trackedEntity = void 0),
              (this.state = "no");
          },
        },
        {
          key: "setUnit",
          value: function (unit) {
            for (var i = 1; i < this.labels.length; i++) {
              var labelEnt = this.labels[i],
                distance = labelEnt.distance,
                labelEnt = labelEnt.label;
              labelEnt &&
                (i == this.labels.length - 1
                  ? (labelEnt.text =
                      "总长：" + this.formateLength(distance, unit))
                  : (labelEnt.text = this.formateLength(distance, unit)));
            }
            this.unit = unit;
          },
        },
      ]),
      MeasureSpaceDistance
    );
  })(),
  MeasureSpaceArea = (function () {
    _inherits(MeasureSpaceArea, BaseMeasure);
    var _super = _createSuper(MeasureSpaceArea);
    function MeasureSpaceArea(viewer, opt) {
      var _this;
      return (
        _classCallCheck(this, MeasureSpaceArea),
        (_this = _super.call(this, viewer, opt)),
        (opt = opt || {}),
        (_this.unitType = "area"),
        (_this.unit = opt.unit || "平方米"),
        (_this.style = opt.style || {}),
        (_this.viewer = viewer),
        (_this.polyline = void 0),
        (_this.polygon = void 0),
        (_this.positions = []),
        (_this.movePush = !1),
        (_this.prompt = void 0),
        _this
      );
    }
    return (
      _createClass(MeasureSpaceArea, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle));
            var that = this;
            (this.state = "startCreate"),
              this.handler.setInputAction(function (evt) {
                that.state = "creating";
                var point,
                  evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  (that.movePush &&
                    (that.positions.pop(), (that.movePush = !1)),
                  ((point = that.createPoint(evt.clone())).wz =
                    that.positions.length),
                  that.controlPoints.push(point),
                  that.positions.push(evt));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                var area, text;
                (that.state = "creating"),
                  that.positions.length < 1
                    ? that.prompt.update(evt.endPosition, "单击开始绘制")
                    : (that.prompt.update(
                        evt.endPosition,
                        "双击结束，右键取消上一步"
                      ),
                      (evt = that.getCatesian3FromPX(
                        evt.endPosition,
                        that.viewer
                      )),
                      1 <= that.positions.length &&
                        (that.movePush
                          ? (that.positions[that.positions.length - 1] = evt)
                          : (that.positions.push(evt), (that.movePush = !0)),
                        2 != that.positions.length ||
                          Cesium.defined(that.polyline) ||
                          (that.polyline = that.createPolyline()),
                        3 == that.positions.length &&
                          (Cesium.defined(that.polygon) ||
                            ((that.polygon = that.createPolygon()),
                            (that.polygon.isFilter = !0),
                            (that.polygon.objId = that.objId)),
                          that.floatLabel ||
                            ((that.floatLabel = that.createLabel(evt, "")),
                            (that.floatLabel.label.heightReference = 1))),
                        that.polygon &&
                          ((area = (evt = that.getAreaAndCenter(that.positions))
                            .area),
                          (evt = evt.center),
                          (text = that.formateArea(area, that.unit)),
                          (that.floatLabel.label.text = "面积：" + text),
                          (that.floatLabel.area = area),
                          evt && that.floatLabel.position.setValue(evt),
                          (that.floatLabel.show = !0))));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.handler.setInputAction(function (evt) {
                var area, text;
                (that.state = "creating"),
                  (that.polyline || that.polygon) &&
                    (that.positions.splice(that.positions.length - 2, 1),
                    that.viewer.entities.remove(that.controlPoints.pop()),
                    2 == that.positions.length &&
                      (that.polygon &&
                        (that.viewer.entities.remove(that.polygon),
                        (that.polygon = void 0),
                        that.polyline && (that.polyline.show = !0)),
                      (that.floatLabel.show = !1)),
                    1 == that.positions.length &&
                      (that.polyline &&
                        (that.viewer.entities.remove(that.polyline),
                        (that.polyline = void 0)),
                      that.prompt.update(evt.endPosition, "单击开始测量"),
                      (that.positions = []),
                      (that.movePush = !1)),
                    2 < that.positions.length &&
                      ((area = (evt = that.getAreaAndCenter(that.positions))
                        .area),
                      (evt = evt.center),
                      (text = that.formateArea(area, that.unit)),
                      (that.floatLabel.label.text = "面积：" + text),
                      evt && that.floatLabel.position.setValue(evt),
                      (that.floatLabel.area = area),
                      (that.floatLabel.show = !0)));
              }, Cesium.ScreenSpaceEventType.RIGHT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.polygon &&
                  (that.positions.pop(),
                  that.viewer.entities.remove(that.controlPoints.pop()),
                  (that.movePush = !1),
                  that.endCreate(),
                  callback && callback(that.polyline));
              }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
          },
        },
        {
          key: "endCreate",
          value: function () {
            this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY),
              (this.viewer.trackedEntity = void 0);
            var areaCenter = this.getAreaAndCenter(this.positions),
              area = areaCenter.area,
              areaCenter = areaCenter.center,
              text = this.formateArea(area, this.unit);
            (this.floatLabel.label.text = "面积：" + text),
              (this.floatLabel.area = area),
              areaCenter && this.floatLabel.position.setValue(areaCenter),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "endCreate");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "creating" == this.state
              ? this.positions.length <= 2 && 1 == this.movePush
                ? this.destroy()
                : this.endCreate()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            if (
              ("endCreate" == this.state || "endEdit" == this.state) &&
              this.polygon
            ) {
              (this.state = "startEdit"),
                this.modifyHandler ||
                  (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                    this.viewer.scene.canvas
                  ));
              for (var that = this, i = 0; i < that.controlPoints.length; i++) {
                var point = that.controlPoints[i];
                point && (point.show = !0);
              }
              this.modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  null != evt.id.wz &&
                  (evt.id.objId || (that.modifyPoint = evt.id),
                  that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
                this.modifyHandler.setInputAction(function (evt) {
                  var wz, text;
                  that.positions.length < 1 ||
                    !that.modifyPoint ||
                    ((evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (that.modifyPoint.position.setValue(evt),
                      (wz = that.modifyPoint.wz),
                      (that.positions[wz] = evt.clone()),
                      (evt = (wz = that.getAreaAndCenter(that.positions)).area),
                      (wz = wz.center),
                      (text = that.formateArea(evt, that.unit)),
                      (that.floatLabel.label.text = "面积：" + text),
                      (that.floatLabel.area = evt),
                      wz && that.floatLabel.position.setValue(wz)));
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
                this.modifyHandler.setInputAction(function (evt) {
                  that.modifyPoint &&
                    ((that.modifyPoint = void 0),
                    that.forbidDrawWorld(!1),
                    callback && callback(),
                    (that.state = "endEdit"));
                }, Cesium.ScreenSpaceEventType.LEFT_UP);
            }
          },
        },
        {
          key: "endEdit",
          value: function () {
            (this.state = "endEdit"),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              point && (point.show = !1);
            }
          },
        },
        {
          key: "destroy",
          value: function () {
            (this.state = "no"),
              this.polyline &&
                (this.viewer.entities.remove(this.polyline),
                (this.polyline = void 0)),
              this.polygon &&
                (this.viewer.entities.remove(this.polygon),
                (this.polygon = void 0)),
              this.floatLabel &&
                (this.viewer.entities.remove(this.floatLabel),
                (this.floatLabel = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              this.viewer.entities.remove(point);
            }
            this.floatLable = void 0;
          },
        },
        {
          key: "createPolyline",
          value: function () {
            var that = this;
            return this.viewer.entities.add({
              polyline: {
                positions: new Cesium.CallbackProperty(function () {
                  return that.positions.concat([that.positions[0]]);
                }, !1),
                material: Cesium.Color.GOLD,
                width: 2,
                clampToGround: !0,
              },
            });
          },
        },
        {
          key: "createPolygon",
          value: function () {
            var that = this;
            return this.viewer.entities.add({
              polygon: new Cesium.PolygonGraphics({
                hierarchy: new Cesium.CallbackProperty(function () {
                  return new Cesium.PolygonHierarchy(that.positions);
                }, !1),
                material:
                  this.style.material || Cesium.Color.WHITE.withAlpha(0.6),
                fill: !0,
              }),
            });
          },
        },
        {
          key: "setUnit",
          value: function (unit) {
            this.unit = unit;
            unit = this.formateArea(this.floatLabel.area, unit);
            this.floatLabel.label.text = "面积：" + unit;
          },
        },
      ]),
      MeasureSpaceArea
    );
  })(),
  MeasureHeight = (function () {
    _inherits(MeasureHeight, BaseMeasure);
    var _super = _createSuper(MeasureHeight);
    function MeasureHeight(viewer, opt) {
      var _this;
      return (
        _classCallCheck(this, MeasureHeight),
        (_this = _super.call(this, viewer, opt)),
        (opt = opt || {}),
        (_this.unitType = "length"),
        (_this.unit = opt.unit || "米"),
        (_this.style = opt.style || {}),
        (_this.viewer = viewer),
        (_this.polyline = void 0),
        (_this.floatLabel = void 0),
        (_this.positions = []),
        _this
      );
    }
    return (
      _createClass(MeasureHeight, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              (this.state = "startCreate");
            var that = this;
            this.handler.setInputAction(function (evt) {
              that.state = "creating";
              var point,
                evt = that.getCatesian3FromPX(evt.position, that.viewer);
              evt &&
                (2 == that.positions.length
                  ? ((that.positions[1] = evt.clone()),
                    ((point = that.createPoint(evt.clone())).wz = 1),
                    that.controlPoints.push(point),
                    that.endCreate(),
                    callback && callback())
                  : ((that.polyline = that.createLine(that.positions, !1)),
                    (that.polyline.objId = that.objId),
                    that.floatLabel ||
                      (that.floatLabel = that.createLabel(evt.clone(), "")),
                    that.positions.push(evt.clone()),
                    ((point = that.createPoint(evt.clone())).wz = 0),
                    that.controlPoints.push(point)));
            }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                var cartesian = that.getCatesian3FromPX(
                  evt.endPosition,
                  that.viewer
                );
                (that.state = "creating"),
                  that.positions.length < 1
                    ? that.prompt.update(evt.endPosition, "单击开始测量")
                    : (that.prompt.update(evt.endPosition, "单击结束"),
                      cartesian &&
                        (that.positions.length < 2
                          ? that.positions.push(cartesian.clone())
                          : (that.positions[1] = cartesian.clone()),
                        (evt = that.getHeightAndCenter(
                          that.positions[0],
                          that.positions[1]
                        )),
                        (cartesian = that.formateLength(evt.height, that.unit)),
                        (that.floatLabel.label.text = "高度差：" + cartesian),
                        (that.floatLabel.length = evt.height),
                        evt.center &&
                          that.floatLabel.position.setValue(evt.center)));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "endCreate",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "endCreate");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "startEdit" == this.state || "editing" == this.state
              ? this.endEdit()
              : this.endCreate();
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            if (
              ("endCreate" == this.state || "endEdit" == this.state) &&
              this.polyline
            ) {
              (this.state = "startEdit"),
                this.modifyHandler ||
                  (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                    this.viewer.scene.canvas
                  ));
              for (var that = this, i = 0; i < that.controlPoints.length; i++) {
                var point = that.controlPoints[i];
                point && (point.show = !0);
              }
              this.modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  null != evt.id.wz &&
                  (evt.id.objId || (that.modifyPoint = evt.id),
                  that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
                this.modifyHandler.setInputAction(function (evt) {
                  var text;
                  that.positions.length < 1 ||
                    !that.modifyPoint ||
                    ((evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (that.modifyPoint.position.setValue(evt.clone()),
                      (that.positions[that.modifyPoint.wz] = evt.clone()),
                      (evt = that.getHeightAndCenter(
                        that.positions[0],
                        that.positions[1]
                      )),
                      (text = that.formateLength(evt.height, that.unit)),
                      (that.floatLabel.label.text = "高度差：" + text),
                      (that.floatLabel.length = evt.height),
                      evt.center &&
                        that.floatLabel.position.setValue(evt.center)));
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
                this.modifyHandler.setInputAction(function (evt) {
                  that.modifyPoint &&
                    ((that.modifyPoint = void 0),
                    (that.lastPosition = void 0),
                    (that.nextPosition = void 0),
                    that.forbidDrawWorld(!1),
                    callback && callback(),
                    (that.state = "endEdit"));
                }, Cesium.ScreenSpaceEventType.LEFT_UP);
            }
          },
        },
        {
          key: "endEdit",
          value: function () {
            (this.state = "endEdit"),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              point && (point.show = !1);
            }
          },
        },
        {
          key: "destroy",
          value: function () {
            this.polyline &&
              (this.viewer.entities.remove(this.polyline),
              (this.polyline = void 0)),
              this.floatLabel &&
                (this.viewer.entities.remove(this.floatLabel),
                (this.floatLabel = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              (this.state = "no");
          },
        },
        {
          key: "getHeightAndCenter",
          value: function (p1, p2) {
            var cartographic1, cartographic2;
            if (p1 && p2)
              return (
                (cartographic1 = Cesium.Cartographic.fromCartesian(p1)),
                (cartographic2 = Cesium.Cartographic.fromCartesian(p2)),
                {
                  height: Math.abs(cartographic1.height - cartographic2.height),
                  center: Cesium.Cartesian3.midpoint(
                    p1,
                    p2,
                    new Cesium.Cartesian3()
                  ),
                }
              );
          },
        },
        {
          key: "setUnit",
          value: function (unit) {
            var text = this.formateLength(this.floatLabel.length, unit);
            (this.floatLabel.label.text = "高度差：" + text),
              (this.unit = unit);
          },
        },
      ]),
      MeasureHeight
    );
  })(),
  MeasureTriangle = (function () {
    _inherits(MeasureTriangle, BaseMeasure);
    var _super = _createSuper(MeasureTriangle);
    function MeasureTriangle(viewer, opt) {
      return (
        _classCallCheck(this, MeasureTriangle),
        (viewer = _super.call(this, viewer, opt)),
        (opt = opt || {}),
        (viewer.unitType = "length"),
        (viewer.style = opt.style || {}),
        (viewer.heightfloatLabel = void 0),
        (viewer.spaceDistancefloatLabel = void 0),
        (viewer.horizonDistancefloatLabel = void 0),
        (viewer.heightLine = void 0),
        (viewer.spaceLine = void 0),
        (viewer.horizonLine = void 0),
        (viewer.firstPosition = void 0),
        (viewer.endPosition = void 0),
        (viewer.midPosition = void 0),
        (viewer.lowPosition = void 0),
        (viewer.highPosition = void 0),
        viewer
      );
    }
    return (
      _createClass(MeasureTriangle, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle));
            var that = this;
            (this.state = 1),
              this.handler.setInputAction(function (evt) {
                var _point,
                  evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  (that.firstPosition
                    ? ((that.endPosition = evt),
                      that.computerPosition(
                        that.firstPosition,
                        that.endPosition
                      ),
                      ((_point = that.createPoint(evt.clone())).wz = 1),
                      that.controlPoints.push(_point),
                      that.handler &&
                        (that.handler.destroy(), (that.handler = void 0)),
                      that.prompt &&
                        (that.prompt.destroy(), (that.prompt = void 0)),
                      (that.state = "endCreate"),
                      callback && callback())
                    : ((that.firstPosition = evt.clone()),
                      (that.heightfloatLabel = that.createLabel(evt, "")),
                      (that.spaceDistancefloatLabel = that.createLabel(
                        evt,
                        ""
                      )),
                      (that.horizonDistancefloatLabel = that.createLabel(
                        evt,
                        ""
                      )),
                      ((_point = that.createPoint(evt.clone())).wz = 0),
                      that.controlPoints.push(_point)));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                var cartesian;
                (that.state = "creating"),
                  that.firstPosition
                    ? (that.prompt.update(evt.endPosition, "单击结束"),
                      (cartesian = that.getCatesian3FromPX(
                        evt.endPosition,
                        that.viewer
                      )) &&
                        ((that.endPosition = cartesian),
                        that.computerPosition(
                          that.firstPosition,
                          that.endPosition
                        ),
                        that.firstPosition &&
                          that.endPosition &&
                          !that.spaceLine &&
                          ((that.spaceLine = that.viewer.entities.add({
                            polyline: {
                              positions: new Cesium.CallbackProperty(
                                function () {
                                  return [that.firstPosition, that.endPosition];
                                },
                                !1
                              ),
                              show: !0,
                              material:
                                new Cesium.PolylineOutlineMaterialProperty({
                                  color: Cesium.Color.GOLD,
                                  outlineWidth: 2,
                                  outlineColor: Cesium.Color.BLACK,
                                }),
                              width: 3,
                            },
                          })),
                          (that.spaceLine.objId = that.objId),
                          (that.heightLine = that.viewer.entities.add({
                            polyline: {
                              positions: new Cesium.CallbackProperty(
                                function () {
                                  return [that.lowPosition, that.midPosition];
                                },
                                !1
                              ),
                              show: !0,
                              material:
                                new Cesium.PolylineOutlineMaterialProperty({
                                  color: Cesium.Color.GOLD,
                                  outlineWidth: 2,
                                  outlineColor: Cesium.Color.BLACK,
                                }),
                              width: 3,
                            },
                          })),
                          (that.heightLine.objId = that.objId),
                          (that.horizonLine = that.viewer.entities.add({
                            polyline: {
                              positions: new Cesium.CallbackProperty(
                                function () {
                                  return [that.highPosition, that.midPosition];
                                },
                                !1
                              ),
                              show: !0,
                              material:
                                new Cesium.PolylineOutlineMaterialProperty({
                                  color: Cesium.Color.GOLD,
                                  outlineWidth: 2,
                                  outlineColor: Cesium.Color.BLACK,
                                }),
                              width: 3,
                            },
                          })),
                          (that.horizonLine.objId = that.objId)),
                        that.spaceLine && that.createLabels()))
                    : that.prompt.update(evt.endPosition, "单击开始测量");
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "computerPosition",
          value: function (p1, p2) {
            var cartographic1 = Cesium.Cartographic.fromCartesian(p1.clone()),
              cartographic2 = Cesium.Cartographic.fromCartesian(p2.clone());
            cartographic1.height > cartographic2.height
              ? ((this.highPosition = p1.clone()),
                (this.lowPosition = p2.clone()),
                (this.midPosition = Cesium.Cartesian3.fromRadians(
                  cartographic2.longitude,
                  cartographic2.latitude,
                  cartographic1.height
                )))
              : ((this.lowPosition = p1.clone()),
                (this.highPosition = p2.clone()),
                (this.midPosition = Cesium.Cartesian3.fromRadians(
                  cartographic1.longitude,
                  cartographic1.latitude,
                  cartographic2.height
                )));
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            if ("endCreate" == this.state || "endEdit" == this.state) {
              (this.state = "startEdit"),
                this.modifyHandler ||
                  (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                    this.viewer.scene.canvas
                  ));
              for (var that = this, i = 0; i < that.controlPoints.length; i++) {
                var point = that.controlPoints[i];
                point && (point.show = !0);
              }
              this.modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  null != evt.id.wz &&
                  (evt.id.objId || (that.modifyPoint = evt.id),
                  that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
                this.modifyHandler.setInputAction(function (evt) {
                  !that.modifyPoint ||
                    ((evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (that.modifyPoint.position.setValue(evt.clone()),
                      0 == that.modifyPoint.wz
                        ? (that.firstPosition = evt.clone())
                        : (that.endPosition = evt.clone()),
                      that.computerPosition(
                        that.firstPosition,
                        that.endPosition
                      ),
                      that.createLabels()));
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
                this.modifyHandler.setInputAction(function (evt) {
                  that.modifyPoint &&
                    ((that.modifyPoint = void 0),
                    that.forbidDrawWorld(!1),
                    (that.state = "endEdit"),
                    callback && callback());
                }, Cesium.ScreenSpaceEventType.LEFT_UP);
            }
          },
        },
        {
          key: "endEdit",
          value: function () {
            (this.state = "endEdit"),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              point && (point.show = !1);
            }
          },
        },
        {
          key: "createLabels",
          value: function () {
            var height = Math.abs(
                Cesium.Cartographic.fromCartesian(this.highPosition).height -
                  Cesium.Cartographic.fromCartesian(this.lowPosition).height
              ),
              height_mid = Cesium.Cartesian3.midpoint(
                this.lowPosition,
                this.midPosition,
                new Cesium.Cartesian3()
              ),
              height_mid =
                ((this.heightfloatLabel.show = !0),
                this.heightfloatLabel.position.setValue(height_mid),
                this.formateLength(height, this.unit)),
              height_mid =
                ((this.heightfloatLabel.label.text = "高度差：" + height_mid),
                (this.heightfloatLabel.length = height),
                Cesium.Cartesian3.distance(
                  this.highPosition,
                  this.midPosition
                )),
              height = Cesium.Cartesian3.midpoint(
                this.highPosition,
                this.midPosition,
                new Cesium.Cartesian3()
              ),
              height =
                ((this.horizonDistancefloatLabel.show = !0),
                this.horizonDistancefloatLabel.position.setValue(height),
                this.formateLength(height_mid, this.unit)),
              height =
                ((this.horizonDistancefloatLabel.label.text =
                  "水平距离：" + height),
                (this.horizonDistancefloatLabel.length = height_mid),
                Cesium.Cartesian3.distance(
                  this.endPosition,
                  this.firstPosition
                )),
              height_mid = Cesium.Cartesian3.midpoint(
                this.endPosition,
                this.firstPosition,
                new Cesium.Cartesian3()
              ),
              height_mid =
                ((this.spaceDistancefloatLabel.show = !0),
                this.spaceDistancefloatLabel.position.setValue(height_mid),
                this.formateLength(height, this.unit));
            (this.spaceDistancefloatLabel.label.text =
              "空间距离：" + height_mid),
              (this.spaceDistancefloatLabel.length = height);
          },
        },
        {
          key: "destroy",
          value: function () {
            (this.state = "no"),
              this.heightLine &&
                (this.viewer.entities.remove(this.heightLine),
                (this.heightLine = void 0)),
              this.spaceLine &&
                (this.viewer.entities.remove(this.spaceLine),
                (this.spaceLine = void 0)),
              this.horizonLine &&
                (this.viewer.entities.remove(this.horizonLine),
                (this.horizonLine = void 0)),
              this.heightfloatLabel &&
                (this.viewer.entities.remove(this.heightfloatLabel),
                (this.heightfloatLabel = void 0)),
              (this.heightfloatLabel = void 0),
              this.spaceDistancefloatLabel &&
                (this.viewer.entities.remove(this.spaceDistancefloatLabel),
                (this.spaceDistancefloatLabel = void 0)),
              (this.spaceDistancefloatLabel = void 0),
              this.horizonDistancefloatLabel &&
                (this.viewer.entities.remove(this.horizonDistancefloatLabel),
                (this.horizonDistancefloatLabel = void 0)),
              (this.horizonDistancefloatLabel = void 0),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0));
          },
        },
        {
          key: "setUnit",
          value: function (unit) {
            var text1;
            this.heightfloatLabel &&
              ((text1 = this.formateLength(this.heightfloatLabel.length, unit)),
              (this.heightfloatLabel.label.text = "高度差：" + text1)),
              this.horizonDistancefloatLabel &&
                ((text1 = this.formateLength(
                  this.horizonDistancefloatLabel.length,
                  unit
                )),
                (this.horizonDistancefloatLabel.label.text =
                  "水平距离：" + text1)),
              this.spaceDistancefloatLabel &&
                ((text1 = this.formateLength(
                  this.spaceDistancefloatLabel.length,
                  unit
                )),
                (this.spaceDistancefloatLabel.label.text =
                  "空间距离：" + text1)),
              (this.unit = unit);
          },
        },
      ]),
      MeasureTriangle
    );
  })(),
  MeasureLnglat = (function () {
    _inherits(MeasureLnglat, BaseMeasure);
    var _super = _createSuper(MeasureLnglat);
    function MeasureLnglat(viewer, opt) {
      return (
        _classCallCheck(this, MeasureLnglat),
        ((viewer = _super.call(this, viewer, opt)).type = "mesureLnglat"),
        (viewer.style = opt.style || {}),
        (viewer.point = void 0),
        (viewer.position = void 0),
        (viewer.state = 0),
        viewer
      );
    }
    return (
      _createClass(MeasureLnglat, [
        {
          key: "start",
          value: function (callback) {
            this.state = "startCreate";
            var that = this;
            this.handler.setInputAction(function (evt) {
              callback && callback(), that.endCreate();
            }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.state = "creating";
                var evt = that.getCatesian3FromPX(evt.endPosition, that.viewer);
                evt &&
                  ((that.position = evt.clone()),
                  Cesium.defined(that.point) ||
                    ((that.point = that.createPoint()),
                    (that.point.objId = that.objId)),
                  (evt = util$1.cartesianToLnglat(evt, that.viewer)),
                  (that.point.label.text =
                    "经度：" +
                    evt[0].toFixed(6) +
                    "\n纬度：" +
                    evt[1].toFixed(6) +
                    "\n高度：" +
                    evt[2].toFixed(2) +
                    " m"));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "endCreate",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              (this.state = "endCreate");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "startEdit" == this.state || "editing" == this.state
              ? this.endEdit()
              : this.endCreate();
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            var that;
            ("endCreate" != this.state && "endEdit" != this.state) ||
              !this.point ||
              ((this.state = "startEdit"),
              this.modifyHandler ||
                (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              (that = this).modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  (evt.id.objId || (that.modifyPoint = evt.id),
                  that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.modifyHandler.setInputAction(function (evt) {
                this.state = "editing";
                var evt = that.getCatesian3FromPX(evt.endPosition, that.viewer);
                evt &&
                  (that.modifyPoint.position.setValue(evt.clone()),
                  (evt = util$1.cartesianToLnglat(evt, that.viewer)),
                  (that.modifyPoint.label.text =
                    "经度：" +
                    evt[0].toFixed(6) +
                    "\n纬度：" +
                    evt[1].toFixed(6) +
                    "\n高度：" +
                    evt[2].toFixed(2) +
                    " m"),
                  heightAndCenter.center &&
                    that.floatLabel.position.setValue(heightAndCenter.center));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.modifyHandler.setInputAction(function (evt) {
                that.modifyPoint && callback && callback();
              }, Cesium.ScreenSpaceEventType.LEFT_UP));
          },
        },
        {
          key: "endEdit",
          value: function () {
            this.modifyHandler &&
              (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              this.forbidDrawWorld(!1),
              (this.state = "endEdit");
          },
        },
        {
          key: "destroy",
          value: function () {
            (this.state = "no"),
              this.point &&
                (this.viewer.entities.remove(this.point),
                (this.point = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0));
          },
        },
        {
          key: "createPoint",
          value: function () {
            var _point,
              that = this;
            return this.viewer.entities.add({
              position: new Cesium.CallbackProperty(function () {
                return that.position;
              }, !1),
              point:
                (_defineProperty(
                  (_point = { show: !0, outlineColor: Cesium.Color.YELLOW }),
                  "outlineColor",
                  Cesium.Color.WHITE
                ),
                _defineProperty(_point, "pixelSize", 6),
                _defineProperty(_point, "outlineWidth", 2),
                _defineProperty(
                  _point,
                  "disableDepthTestDistance",
                  Number.MAX_VALUE
                ),
                _point),
              label: {
                font: "18px Helvetica",
                fillColor: Cesium.Color.WHITE,
                outlineColor: Cesium.Color.BLACK,
                outlineWidth: 2,
                disableDepthTestDistance: Number.POSITIVE_INFINITY,
                style: Cesium.LabelStyle.FILL_AND_OUTLINE,
                pixelOffset: new Cesium.Cartesian2(0, -60),
              },
            });
          },
        },
      ]),
      MeasureLnglat
    );
  })(),
  MeasureAzimutht = (function () {
    _inherits(MeasureAzimutht, BaseMeasure);
    var _super = _createSuper(MeasureAzimutht);
    function MeasureAzimutht(viewer, opt) {
      return (
        _classCallCheck(this, MeasureAzimutht),
        ((viewer = _super.call(this, viewer, opt)).style = opt.style || {}),
        (viewer.polyline = void 0),
        (viewer.floatLabel = void 0),
        (viewer.positions = []),
        (viewer.mtx = void 0),
        (viewer.azimutht = void 0),
        viewer
      );
    }
    return (
      _createClass(MeasureAzimutht, [
        {
          key: "start",
          value: function (callback) {
            var that = this;
            (this.state = "startCreate"),
              !this.prompt &&
                this.promptStyle.show &&
                (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              this.handler.setInputAction(function (evt) {
                var point,
                  evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  (2 == that.positions.length &&
                    (that.positions.pop(),
                    ((point = that.createPoint(evt.clone())).wz = 1),
                    that.controlPoints.push(point),
                    (that.state = "endCreate"),
                    that.endCreate(),
                    callback && callback(that.azimutht)),
                  that.polyline ||
                    ((that.polyline = that.createLine(that.positions, !0)),
                    (that.polyline.objId = that.objId),
                    (that.polyline.polyline.width = 6),
                    (that.polyline.polyline.material =
                      new Cesium.PolylineArrowMaterialProperty(
                        Cesium.Color.YELLOW
                      ))),
                  that.positions.push(evt),
                  1 == that.positions.length &&
                    ((that.mtx = Cesium.Transforms.eastNorthUpToFixedFrame(
                      that.positions[0].clone()
                    )),
                    (that.floatLabel = that.createLabel(evt, "")),
                    ((point = that.createPoint(evt.clone())).wz = 0),
                    that.controlPoints.push(point)));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.positions.length < 1
                  ? that.prompt.update(evt.endPosition, "单击开始测量")
                  : (that.prompt.update(evt.endPosition, "单击结束"),
                    (that.state = "creating"),
                    (evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (that.positions.length < 2
                        ? that.positions.push(evt.clone())
                        : (that.positions[1] = evt.clone()),
                      that.floatLabel &&
                        ((that.azimutht = that.getAzimuthtAndCenter(
                          that.mtx,
                          that.positions
                        )),
                        (that.floatLabel.label.text =
                          "方位角：" + that.azimutht.toFixed(2)))));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "endCreate",
          value: function () {
            (this.state = "endCreate"),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0));
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "startEdit" == this.state || "editing" == this.state
              ? this.endEdit()
              : this.endCreate();
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            if (
              ("endCreate" == this.state || "endEdit" == this.state) &&
              this.polyline
            ) {
              (this.state = "startEdit"),
                this.modifyHandler ||
                  (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                    this.viewer.scene.canvas
                  ));
              for (var that = this, i = 0; i < that.controlPoints.length; i++) {
                var point = that.controlPoints[i];
                point && (point.show = !0);
              }
              this.modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  null != evt.id.wz &&
                  (evt.id.objId || (that.modifyPoint = evt.id),
                  that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
                this.modifyHandler.setInputAction(function (evt) {
                  that.positions.length < 1 ||
                    !that.modifyPoint ||
                    ((evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (that.modifyPoint.position.setValue(evt.clone()),
                      0 == that.modifyPoint.wz &&
                        (that.floatLabel.position.setValue(evt.clone()),
                        (that.mtx = Cesium.Transforms.eastNorthUpToFixedFrame(
                          that.positions[0].clone()
                        ))),
                      (that.positions[that.modifyPoint.wz] = evt.clone()),
                      (that.azimutht = that.getAzimuthtAndCenter(
                        that.mtx,
                        that.positions
                      )),
                      (that.floatLabel.label.text =
                        "方位角：" + that.azimutht.toFixed(2))));
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
                this.modifyHandler.setInputAction(function (evt) {
                  that.modifyPoint &&
                    ((that.modifyPoint = void 0),
                    (that.lastPosition = void 0),
                    (that.nextPosition = void 0),
                    that.forbidDrawWorld(!1),
                    callback && callback(),
                    (that.state = "endEdit"));
                }, Cesium.ScreenSpaceEventType.LEFT_UP);
            }
          },
        },
        {
          key: "endEdit",
          value: function () {
            (this.state = "endEdit"),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              point && (point.show = !1);
            }
          },
        },
        {
          key: "destroy",
          value: function () {
            this.polyline &&
              (this.viewer.entities.remove(this.polyline),
              (this.polyline = void 0)),
              this.floatLabel &&
                (this.viewer.entities.remove(this.floatLabel),
                (this.floatLabel = void 0)),
              (this.floatLable = void 0),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              (this.state = "no"),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0));
          },
        },
      ]),
      MeasureAzimutht
    );
  })(),
  MeasureSection = (function () {
    _inherits(MeasureSection, BaseMeasure);
    var _super = _createSuper(MeasureSection);
    function MeasureSection(viewer, opt) {
      var _this;
      return (
        _classCallCheck(this, MeasureSection),
        ((_this = _super.call(this, viewer, opt)).style = opt.style || {}),
        (_this.viewer = viewer),
        (_this.polyline = void 0),
        (_this.positions = []),
        (_this.movePush = !1),
        _this.prompt,
        (_this.isStart = !1),
        (_this.firstPosition = void 0),
        (_this.state = "no"),
        _this
      );
    }
    return (
      _createClass(MeasureSection, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt(this.viewer, this.promptStyle));
            var that = this;
            (that.state = "startCreate"),
              this.handler.setInputAction(function (evt) {
                evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  (that.isStart
                    ? (that.handler &&
                        (that.handler.destroy(), (that.handler = void 0)),
                      that.prompt &&
                        (that.prompt.destroy(), (that.prompt = void 0)),
                      that.getHeight(that.positions, function (data) {
                        callback(data);
                      }),
                      (that.state = "endCreate"))
                    : ((that.isStart = !0), (that.firstPosition = evt)));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                var cartesian;
                (that.state = "creating"),
                  that.isStart
                    ? (that.prompt.update(evt.endPosition, "再次单击结束"),
                      (cartesian = that.getCatesian3FromPX(
                        evt.endPosition,
                        that.viewer
                      )),
                      (that.positions = [that.firstPosition, cartesian]),
                      that.polyline ||
                        (that.polyline = that.viewer.entities.add({
                          polyline: {
                            show: !0,
                            positions: new Cesium.CallbackProperty(function () {
                              return that.positions;
                            }, !1),
                            material: Cesium.Color.GREEN,
                            width: 3,
                            clampToGround: !0,
                          },
                        })))
                    : that.prompt.update(evt.endPosition, "单击开始");
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.polyline &&
              (this.viewer.entities.remove(this.polyline),
              (this.polyline = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY),
              (this.viewer.trackedEntity = void 0),
              (this.state = "no");
          },
        },
        {
          key: "getHeight",
          value: function (positions, callback) {
            var ctgs, height;
            !positions ||
              positions.length < 1 ||
              ((positions = util.lerpPositions(positions)),
              (ctgs = []),
              positions.forEach(function (item) {
                ctgs.push(Cesium.Cartographic.fromCartesian(item));
              }),
              !ctgs ||
                ctgs.length < 1 ||
                ((height = Cesium.Cartographic.fromCartesian(
                  positions[0]
                ).height),
                Cesium.sampleTerrainMostDetailed(
                  this.viewer.terrainProvider,
                  ctgs
                ).then(function (updateLnglats) {
                  for (var i = 0; i < updateLnglats.length; i++) {
                    var item = updateLnglats[i];
                    item.height = item.height || height;
                  }
                  callback &&
                    callback({ positions: positions, lnglats: updateLnglats });
                })));
          },
        },
      ]),
      MeasureSection
    );
  })(),
  MeasureSlope = (function () {
    _inherits(MeasureSlope, BaseMeasure);
    var _super = _createSuper(MeasureSlope);
    function MeasureSlope(viewer, opt) {
      var _this;
      return (
        _classCallCheck(this, MeasureSlope),
        ((_this = _super.call(this, viewer, opt)).type = "mesureSlop"),
        (_this.style = opt.style || {}),
        (_this.viewer = viewer),
        (_this.label = void 0),
        (_this.point = void 0),
        (_this.arrow = void 0),
        _this
      );
    }
    return (
      _createClass(MeasureSlope, [
        {
          key: "start",
          value: function (callabck) {
            this.state = "startCreate";
            var that = this;
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              this.handler.setInputAction(function (evt) {
                var cartesian = that.getCatesian3FromPX(
                  evt.position,
                  that.viewer
                );
                cartesian &&
                  (that.point || (that.point = that.createPoint(cartesian)),
                  that.point.position.setValue(cartesian),
                  that.getSlope(cartesian, function (direction, slop, angle) {
                    that.label ||
                      (that.label = that.createLabel(cartesian, "")),
                      that.label.position.setValue(cartesian);
                    slop = (100 * slop).toFixed(2) + "%";
                    (that.label.label.text =
                      "坡度：" + angle.toFixed(2) + "°(" + slop + ")"),
                      that.arrow ||
                        (that.arrow = that.createArrow(cartesian, direction));
                  }),
                  callabck && callabck(),
                  that.endCreate());
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                (that.state = "creating"),
                  that.prompt &&
                    that.prompt.update(evt.endPosition, "点击开始测量");
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "endCreate",
          value: function () {
            this.handler && (this.handler.destroy(), (this.handler = void 0)),
              this.prompt && (this.prompt.destroy(), (this.prompt = void 0)),
              (this.state = "endCreate");
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            ("endCreate" != this.state && "endEdit" != this.state) ||
              !this.point ||
              ((this.state = "startEdit"),
              this.modifyHandler ||
                (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              this.modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  null != evt.id.wz &&
                  (evt.id.objId || (that.modifyPoint = evt.id),
                  that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.modifyHandler.setInputAction(function (evt) {
                var text;
                that.positions.length < 1 ||
                  !that.modifyPoint ||
                  ((evt = that.getCatesian3FromPX(
                    evt.endPosition,
                    that.viewer
                  )) &&
                    (that.modifyPoint.position.setValue(evt.clone()),
                    (that.positions[that.modifyPoint.wz] = evt.clone()),
                    (evt = that.getHeightAndCenter(
                      that.positions[0],
                      that.positions[1]
                    )),
                    (text = that.formateLength(evt.height, that.unit)),
                    (that.floatLabel.label.text = "高度差：" + text),
                    (that.floatLabel.length = evt.height),
                    evt.center &&
                      that.floatLabel.position.setValue(evt.center)));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.modifyHandler.setInputAction(function (evt) {
                that.modifyPoint &&
                  ((that.modifyPoint = void 0),
                  (that.lastPosition = void 0),
                  (that.nextPosition = void 0),
                  that.forbidDrawWorld(!1),
                  callback && callback(),
                  (that.state = "endEdit"));
              }, Cesium.ScreenSpaceEventType.LEFT_UP));
          },
        },
        {
          key: "endEdit",
          value: function () {
            this.modifyHandler &&
              (this.modifyHandler.destroy(), (this.modifyHandler = void 0)),
              that.forbidDrawWorld(!1),
              (this.state = "endEdit");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "startEdit" == this.state || "editing" == this.state
              ? this.endEdit()
              : this.endCreate();
          },
        },
        {
          key: "destroy",
          value: function () {
            (this.state = "no"),
              this.label &&
                (this.viewer.entities.remove(this.label),
                (this.label = void 0)),
              this.point &&
                (this.viewer.entities.remove(this.point),
                (this.point = void 0)),
              this.arrow &&
                (this.viewer.entities.remove(this.arrow),
                (this.arrow = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0));
          },
        },
        {
          key: "createPoint",
          value: function (position) {
            return this.viewer.entities.add({
              position: position,
              point:
                (_defineProperty(
                  (position = {
                    heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
                    show: !0,
                    fillColor: Cesium.Color.WHITE,
                    outlineColor: Cesium.Color.RED,
                    outlineWidth: 2,
                    pixelSize: 6,
                  }),
                  "outlineWidth",
                  3
                ),
                _defineProperty(
                  position,
                  "disableDepthTestDistance",
                  Number.MAX_VALUE
                ),
                position),
            });
          },
        },
        {
          key: "createArrow",
          value: function (center, direction) {
            (direction = Cesium.Cartesian3.multiplyByScalar(
              direction,
              10,
              new Cesium.Cartesian3()
            )),
              (direction = Cesium.Cartesian3.add(
                center,
                direction,
                new Cesium.Cartesian3()
              ));
            return this.viewer.entities.add({
              name: "Purple straight arrow at height",
              polyline: {
                positions: [center, direction.clone()],
                width: 3,
                material: new Cesium.PolylineArrowMaterialProperty(
                  Cesium.Color.YELLOW
                ),
                clampToGround: !0,
              },
            });
          },
        },
      ]),
      MeasureSlope
    );
  })(),
  MeasureSpaceArea$1 = (function () {
    _inherits(MeasureSpaceArea, BaseMeasure);
    var _super = _createSuper(MeasureSpaceArea);
    function MeasureSpaceArea(viewer, opt) {
      var _this;
      return (
        _classCallCheck(this, MeasureSpaceArea),
        (_this = _super.call(this, viewer, opt)),
        (opt = opt || {}),
        (_this.unitType = "area"),
        (_this.unit = opt.unit || "平方米"),
        (_this.style = opt.style || {}),
        (_this.viewer = viewer),
        (_this.polyline = void 0),
        (_this.polygon = void 0),
        (_this.positions = []),
        (_this.movePush = !1),
        (_this.prompt = void 0),
        (_this.geometry = void 0),
        _this
      );
    }
    return (
      _createClass(MeasureSpaceArea, [
        {
          key: "start",
          value: function (callback) {
            !this.prompt &&
              this.promptStyle.show &&
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle));
            var that = this;
            (this.state = "startCreate"),
              this.handler.setInputAction(function (evt) {
                that.state = "creating";
                var point,
                  evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  (that.movePush &&
                    (that.positions.pop(), (that.movePush = !1)),
                  ((point = that.createPoint(evt.clone())).wz =
                    that.positions.length),
                  that.controlPoints.push(point),
                  that.positions.push(evt));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                (that.state = "creating"),
                  that.positions.length < 1
                    ? that.prompt.update(evt.endPosition, "单击开始绘制")
                    : (that.prompt.update(
                        evt.endPosition,
                        "双击结束，右键取消上一步"
                      ),
                      (evt = that.getCatesian3FromPX(
                        evt.endPosition,
                        that.viewer
                      )),
                      1 <= that.positions.length &&
                        (that.movePush
                          ? (that.positions[that.positions.length - 1] = evt)
                          : (that.positions.push(evt), (that.movePush = !0)),
                        2 != that.positions.length ||
                          Cesium.defined(that.polyline) ||
                          (that.polyline = that.createPolyline()),
                        3 == that.positions.length &&
                          (Cesium.defined(that.polygon) ||
                            ((that.polygon = that.createPolygon()),
                            (that.polygon.isFilter = !0),
                            (that.polygon.objId = that.objId)),
                          that.floatLabel ||
                            ((that.floatLabel = that.createLabel(evt, "")),
                            (that.floatLabel.label.heightReference = 1))),
                        that.polygon &&
                          that.getGroundAreaAndCenter(
                            that.positions,
                            function (area, center) {
                              var text = that.formateArea(area, that.unit);
                              (that.floatLabel.label.text = "面积：" + text),
                                (that.floatLabel.area = area),
                                center &&
                                  that.floatLabel.position.setValue(center),
                                (that.floatLabel.show = !0);
                            }
                          )));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.handler.setInputAction(function (evt) {
                (that.state = "creating"),
                  (that.polyline || that.polygon) &&
                    (that.positions.splice(that.positions.length - 2, 1),
                    that.viewer.entities.remove(that.controlPoints.pop()),
                    2 == that.positions.length &&
                      (that.polygon &&
                        (that.viewer.entities.remove(that.polygon),
                        (that.polygon = void 0),
                        that.polyline && (that.polyline.show = !0)),
                      (that.floatLabel.show = !1)),
                    1 == that.positions.length &&
                      (that.polyline &&
                        (that.viewer.entities.remove(that.polyline),
                        (that.polyline = void 0)),
                      that.prompt.update(evt.endPosition, "单击开始测量"),
                      (that.positions = []),
                      (that.movePush = !1)),
                    2 < that.positions.length &&
                      that.getGroundAreaAndCenter(
                        that.positions,
                        function (area, center) {
                          var text = that.formateArea(area, that.unit);
                          (that.floatLabel.label.text = "面积：" + text),
                            center && that.floatLabel.position.setValue(center),
                            (that.floatLabel.area = area),
                            (that.floatLabel.show = !0);
                        }
                      ));
              }, Cesium.ScreenSpaceEventType.RIGHT_CLICK),
              this.handler.setInputAction(function (evt) {
                that.polygon &&
                  (that.positions.pop(),
                  that.viewer.entities.remove(that.controlPoints.pop()),
                  (that.movePush = !1),
                  that.endCreate(),
                  callback && callback(that.polyline));
              }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
          },
        },
        {
          key: "endCreate",
          value: function () {
            var that = this;
            that.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY),
              (that.viewer.trackedEntity = void 0),
              that.getGroundAreaAndCenter(
                that.positions,
                function (area, center) {
                  var text = that.formateArea(area, that.unit);
                  (that.floatLabel.label.text = "面积：" + text),
                    (that.floatLabel.area = area),
                    center && that.floatLabel.position.setValue(center);
                }
              ),
              that.handler && (that.handler.destroy(), (that.handler = void 0)),
              that.prompt && (that.prompt.destroy(), (that.prompt = void 0)),
              (that.state = "endCreate");
          },
        },
        {
          key: "done",
          value: function () {
            "startCreate" == this.state
              ? this.destroy()
              : "creating" == this.state
              ? this.positions.length <= 2 && 1 == this.movePush
                ? this.destroy()
                : this.endCreate()
              : ("startEdit" != this.state && "editing" != this.state) ||
                this.endEdit();
          },
        },
        {
          key: "startEdit",
          value: function (callback) {
            if (
              ("endCreate" == this.state || "endEdit" == this.state) &&
              this.polygon
            ) {
              (this.state = "startEdit"),
                this.modifyHandler ||
                  (this.modifyHandler = new Cesium.ScreenSpaceEventHandler(
                    this.viewer.scene.canvas
                  ));
              for (var that = this, i = 0; i < that.controlPoints.length; i++) {
                var point = that.controlPoints[i];
                point && (point.show = !0);
              }
              this.modifyHandler.setInputAction(function (evt) {
                evt = that.viewer.scene.pick(evt.position);
                Cesium.defined(evt) &&
                  evt.id &&
                  null != evt.id.wz &&
                  (evt.id.objId || (that.modifyPoint = evt.id),
                  that.forbidDrawWorld(!0));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
                this.modifyHandler.setInputAction(function (evt) {
                  var wz;
                  that.positions.length < 1 ||
                    !that.modifyPoint ||
                    ((evt = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (that.modifyPoint.position.setValue(evt),
                      (wz = that.modifyPoint.wz),
                      (that.positions[wz] = evt.clone()),
                      that.getGroundAreaAndCenter(
                        that.positions,
                        function (area, center) {
                          var text = that.formateArea(area, that.unit);
                          (that.floatLabel.label.text = "面积：" + text),
                            (that.floatLabel.area = area),
                            center && that.floatLabel.position.setValue(center);
                        }
                      )));
                }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
                this.modifyHandler.setInputAction(function (evt) {
                  that.modifyPoint &&
                    ((that.modifyPoint = void 0),
                    that.forbidDrawWorld(!1),
                    callback && callback(),
                    (that.state = "endEdit"));
                }, Cesium.ScreenSpaceEventType.LEFT_UP);
            }
          },
        },
        {
          key: "endEdit",
          value: function () {
            (this.state = "endEdit"),
              this.modifyHandler &&
                (this.modifyHandler.destroy(), (this.modifyHandler = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              point && (point.show = !1);
            }
          },
        },
        {
          key: "destroy",
          value: function () {
            (this.state = "no"),
              this.polyline &&
                (this.viewer.entities.remove(this.polyline),
                (this.polyline = void 0)),
              this.polygon &&
                (this.viewer.entities.remove(this.polygon),
                (this.polygon = void 0)),
              this.floatLabel &&
                (this.viewer.entities.remove(this.floatLabel),
                (this.floatLabel = void 0)),
              this.handler && (this.handler.destroy(), (this.handler = void 0));
            for (var i = 0; i < this.controlPoints.length; i++) {
              var point = this.controlPoints[i];
              this.viewer.entities.remove(point);
            }
            this.floatLable = void 0;
          },
        },
        {
          key: "createPolyline",
          value: function () {
            var that = this;
            return this.viewer.entities.add({
              polyline: {
                positions: new Cesium.CallbackProperty(function () {
                  return that.positions.concat([that.positions[0]]);
                }, !1),
                material: Cesium.Color.GOLD,
                width: 2,
                clampToGround: !0,
              },
            });
          },
        },
        {
          key: "createPolygon",
          value: function () {
            var that = this;
            return this.viewer.entities.add({
              polygon: new Cesium.PolygonGraphics({
                hierarchy: new Cesium.CallbackProperty(function () {
                  return new Cesium.PolygonHierarchy(that.positions);
                }, !1),
                material:
                  this.style.material || Cesium.Color.WHITE.withAlpha(0.6),
                heightReference: 1,
                fill: !0,
              }),
            });
          },
        },
        {
          key: "setUnit",
          value: function (unit) {
            this.unit = unit;
            unit = this.formateArea(this.floatLabel.area, unit);
            this.floatLabel.label.text = "面积：" + unit;
          },
        },
        {
          key: "getGroundAreaAndCenter",
          value: function (positions, callback) {
            var _this2 = this;
            if (positions && !(positions.length < 2)) {
              for (
                var area = util$1.computeArea(positions, this.viewer),
                  area = new Cesium.PolygonGeometry.fromPositions({
                    positions: positions,
                    vertexFormat:
                      Cesium.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
                    granularity:
                      (Math.PI / Math.pow(2, 11) / 1e3) * (area / 10),
                  }),
                  geom = new Cesium.PolygonGeometry.createGeometry(area),
                  indices = geom.indices,
                  attrPosition = geom.attributes.position,
                  arr = [],
                  ctgcs = [],
                  index = 0;
                index < indices.length;
                index += 3
              ) {
                var first = indices[index],
                  second = indices[index + 1],
                  third = indices[index + 2],
                  first = new Cesium.Cartesian3(
                    attrPosition.values[3 * first],
                    geom.attributes.position.values[3 * first + 1],
                    attrPosition.values[3 * first + 2]
                  ),
                  ctgc1 = Cesium.Cartographic.fromCartesian(first.clone()),
                  first =
                    (arr.push(first.clone()),
                    ctgcs.push(ctgc1),
                    new Cesium.Cartesian3(
                      attrPosition.values[3 * second],
                      geom.attributes.position.values[3 * second + 1],
                      attrPosition.values[3 * second + 2]
                    )),
                  ctgc1 = Cesium.Cartographic.fromCartesian(first.clone()),
                  second =
                    (arr.push(first.clone()),
                    ctgcs.push(ctgc1),
                    new Cesium.Cartesian3(
                      geom.attributes.position.values[3 * third],
                      geom.attributes.position.values[3 * third + 1],
                      attrPosition.values[3 * third + 2]
                    )),
                  first = Cesium.Cartographic.fromCartesian(second.clone());
                arr.push(second.clone()), ctgcs.push(first);
              }
              Cesium.sampleTerrainMostDetailed(
                this.viewer.terrainProvider,
                ctgcs
              ).then(function (newCtgcs) {
                for (
                  var area = 0,
                    center = _this2.getCenter(positions),
                    center = Cesium.Cartesian3.fromDegrees(
                      center[0],
                      center[1]
                    ),
                    ind = 0;
                  ind < newCtgcs.length;
                  ind += 3
                ) {
                  var c1 = newCtgcs[ind],
                    c2 = newCtgcs[ind + 1],
                    c3 = newCtgcs[ind + 2],
                    c1 = Cesium.Cartographic.toCartesian(c1),
                    c2 = Cesium.Cartographic.toCartesian(c2),
                    c3 = Cesium.Cartographic.toCartesian(c3);
                  area += util$1.computeAreaOfTriangle(c1, c2, c3);
                }
                callback && callback(area, center);
              });
            }
          },
        },
        {
          key: "getCenter",
          value: function (positions) {
            if (positions && !(positions.length < 1)) {
              for (
                var features, cartographics = [], turfPoints = [], i = 0;
                i < positions.length;
                i++
              ) {
                var cartesian3 = positions[i],
                  cartesian3 = Cesium.Cartographic.fromCartesian(cartesian3);
                cartographics.push([
                  Cesium.Math.toDegrees(cartesian3.longitude),
                  Cesium.Math.toDegrees(cartesian3.latitude),
                ]),
                  turfPoints.push(
                    point([
                      Cesium.Math.toDegrees(cartesian3.longitude),
                      Cesium.Math.toDegrees(cartesian3.latitude),
                    ])
                  );
              }
              if (cartographics.length)
                return (
                  (cartographics = cartographics.concat([cartographics[0]])),
                  (features = featureCollection(turfPoints)),
                  center(features).geometry.coordinates
                );
            }
          },
        },
      ]),
      MeasureSpaceArea
    );
  })(),
  MeasureTool = (function () {
    function MeasureTool(viewer, obj) {
      _classCallCheck(this, MeasureTool),
        viewer
          ? ((obj = obj || {}),
            (this.viewer = viewer),
            (this.nowDrawMeasureObj = void 0),
            (this.measureObjArr = []),
            (this.nowEditMeasureObj = void 0),
            (this.handler = void 0),
            (this.canEdit = null == obj.canEdit || obj.canEdit),
            (this.fireEdit = null == obj.fireEdit || obj.fireEdit),
            this.bindEdit(),
            (this.nowDrawMeasureObj = void 0),
            (this.nowEditMeasureObj = void 0))
          : console.warn("缺少必要参数！--viewer");
    }
    return (
      _createClass(MeasureTool, [
        {
          key: "on",
          value: function (type, fun) {
            "endCreate" == type && (this.endCreateFun = fun),
              "startEdit" == type && (this.startEditFun = fun),
              "endEdit" == type && (this.endEditFun = fun);
          },
        },
        {
          key: "start",
          value: function (opt) {
            var ms;
            if (
              (opt = opt || {}).type &&
              (this.endEdit(),
              !this.nowDrawMeasureObj ||
                "endCreate" == this.nowDrawMeasureObj.state ||
                "endEdit" == this.nowDrawMeasureObj.state ||
                "no" == this.nowDrawMeasureObj.state)
            ) {
              switch (Number(opt.type)) {
                case 1:
                  ms = new MeasureSpaceDistance(this.viewer, opt);
                  break;
                case 2:
                  ms = new MeasureGroundDistance(this.viewer, opt);
                  break;
                case 3:
                  ms = new MeasureSpaceArea(this.viewer, opt);
                  break;
                case 4:
                  ms = new MeasureHeight(this.viewer, opt);
                  break;
                case 5:
                  ms = new MeasureTriangle(this.viewer, opt);
                  break;
                case 6:
                  ms = new MeasureLnglat(this.viewer, opt);
                  break;
                case 7:
                  ms = new MeasureAzimutht(this.viewer, opt);
                  break;
                case 8:
                  ms = new MeasureSection(this.viewer, opt);
                  break;
                case 9:
                  ms = new MeasureSlope(this.viewer, opt);
                  break;
                case 12:
                  ms = new MeasureSpaceArea$1(this.viewer);
              }
              (this.nowDrawMeasureObj = ms),
                (this.nowDrawMeasureObj.attr = opt || {});
              var that = this;
              return (
                ms &&
                  (this.changeCursor(!0),
                  ms.start(function (res) {
                    that.changeCursor(!1),
                      that.fireEdit &&
                        "measureSlop" != ms.type &&
                        "measureLnglat" != ms.type &&
                        (ms.startEdit(),
                        (that.nowEditMeasureObj = ms),
                        that.startEditFun && that.startEditFun(ms)),
                      opt.success && opt.success(ms, res),
                      that.endCreateFun && that.endCreateFun(ms, res),
                      (that.nowDrawMeasureObj = void 0),
                      that.measureObjArr.push(ms);
                  })),
                ms
              );
            }
          },
        },
        {
          key: "bindEdit",
          value: function () {
            var that = this;
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.handler.setInputAction(function (evt) {
                if (that.canEdit && !that.nowDrawMeasureObj) {
                  var pick = that.viewer.scene.pick(evt.position);
                  if (Cesium.defined(pick) && pick.id && pick.id.objId) {
                    for (var i = 0; i < that.measureObjArr.length; i++)
                      if (
                        pick.id.objId == that.measureObjArr[i].objId &&
                        ("endCreate" == that.measureObjArr[i].state ||
                          "endEdit" == that.measureObjArr[i].state)
                      ) {
                        that.nowEditMeasureObj &&
                          (that.nowEditMeasureObj.endEdit(),
                          that.endEditFun &&
                            that.endEditFun(that.nowEditMeasureObj),
                          (that.nowEditMeasureObj = void 0)),
                          that.measureObjArr[i].startEdit(),
                          (that.nowEditMeasureObj = that.measureObjArr[i]),
                          that.startEditFun &&
                            that.startEditFun(that.nowEditMeasureObj);
                        break;
                      }
                  } else
                    that.nowEditMeasureObj &&
                      (that.nowEditMeasureObj.endEdit(),
                      that.endEditFun &&
                        that.endEditFun(that.nowEditMeasureObj),
                      (that.nowEditMeasureObj = void 0));
                }
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
          },
        },
        {
          key: "done",
          value: function () {
            this.nowEditMeasureObj &&
              (this.nowEditMeasureObj.done(),
              this.endEditFun && this.endEditFun(this.nowEditMeasureObj),
              (this.nowEditMeasureObj = void 0)),
              this.nowDrawMeasureObj &&
                (this.nowDrawMeasureObj.done(),
                this.measureObjArr.push(this.nowDrawMeasureObj),
                this.endCreateFun && this.endCreateFun(this.nowDrawMeasureObj),
                (this.nowDrawMeasureObj = void 0));
          },
        },
        {
          key: "endEdit",
          value: function () {
            this.nowEditMeasureObj &&
              (this.nowEditMeasureObj.endEdit(),
              this.endEditFun && this.endEditFun(this.nowEditMeasureObj),
              (this.nowEditMeasureObj = void 0));
            for (var i = 0; i < this.measureObjArr.length; i++)
              this.measureObjArr[i].endEdit();
          },
        },
        {
          key: "clear",
          value: function () {
            for (var i = 0; i < this.measureObjArr.length; i++)
              this.measureObjArr[i] &&
                (this.measureObjArr[i].endEdit(),
                this.measureObjArr[i].destroy());
            (this.measureObjArr = []),
              this.nowDrawMeasureObj &&
                (this.nowDrawMeasureObj.destroy(),
                (this.nowDrawMeasureObj = void 0)),
              this.changeCursor(!1);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.clear(),
              this.handler && (this.handler.destroy(), (this.handler = void 0));
          },
        },
        {
          key: "setMeasureObjUnit",
          value: function (item, unit) {
            item && unit && item.setUnit(unit);
          },
        },
        {
          key: "changeCursor",
          value: function (isopen) {
            document.getElementsByTagName("body")[0].style.cursor = isopen
              ? "crosshair"
              : "default";
          },
        },
        {
          key: "getMeasureObjById",
          value: function (id) {
            if (id) {
              for (var res = {}, i = 0; i < this.measureObjArr.length; i++)
                if (this.measureObjArr[i].attr.id == id) {
                  res = { measureObj: this.measureObjArr[i], index: i };
                  break;
                }
              return res;
            }
          },
        },
        {
          key: "getMeasureObjByObjId",
          value: function (id) {
            if (id) {
              for (var res = {}, i = 0; i < this.measureObjArr.length; i++)
                if (this.measureObjArr[i].objId == id) {
                  res = { measureObj: this.measureObjArr[i], index: i };
                  break;
                }
              return res;
            }
          },
        },
        {
          key: "removeOne",
          value: function (measureObj) {
            !measureObj ||
              ((measureObj = this.getMeasureObjByObjId(measureObj.objId))
                .measureObj &&
                (this.measureObjArr.splice(measureObj.index, 1),
                measureObj.measureObj.destroy()));
          },
        },
      ]),
      MeasureTool
    );
  })(),
  Roam = (function () {
    function Roam(viewer, opt) {
      _classCallCheck(this, Roam),
        (this.viewer = viewer),
        (this.objId = Number(
          new Date().getTime() + "" + Number(1e3 * Math.random()).toFixed(0)
        )),
        (this.opt = opt || {}),
        (this.startTime = opt.startTime
          ? Cesium.JulianDate.fromDate(opt.startTime, new Cesium.JulianDate())
          : this.viewer.clock.currentTime.clone()),
        (this.endTime = null),
        this.opt.positions
          ? ((this.positions = this.transfromPositions(this.opt.positions)),
            (this.clockSpeed = 1),
            (this.stopTime = null),
            (this.alldistance = 0),
            (this.alltimes = 0),
            (this.distanceED = -1),
            (this.timesED = -1),
            (this.speed = 0),
            (this.viewType = "no"),
            (this.rendHandler = null),
            (this.isLockView = !1),
            (this.viewXYZ = { x: 0, y: 0, z: 0 }),
            (this.endRoam = opt.endRoam),
            (this.roaming = opt.roaming),
            (this.fixType = this.opt.alltimes ? "0" : "1"),
            this.init(),
            this.setViewType(opt.viewType))
          : console.log("缺少漫游坐标");
    }
    return (
      _createClass(Roam, [
        {
          key: "init",
          value: function () {
            var attr = {};
            if ("0" == this.fixType)
              (this.endTime = Cesium.JulianDate.addSeconds(
                this.startTime,
                Number(this.opt.alltimes),
                new Cesium.JulianDate()
              )),
                (attr = this.createPropertyByTimes(
                  this.positions,
                  this.opt.alltimes
                ));
            else {
              if (!this.opt.speed)
                return void console.log("缺少漫游时长或速度参数！");
              attr = this.createPropertyBySpeed(this.positions, this.opt.speed);
            }
            (this.alldistance = attr.alldistance),
              (this.alltimes = attr.alltimes),
              (this.speed = attr.speed),
              (this.roamEntity = this.createRoamEntity(
                this.opt.entityType,
                attr.property
              ));
          },
        },
        {
          key: "setPositions",
          value: function (positions) {
            this.destroy(), (this.positions = positions), this.init();
          },
        },
        {
          key: "start",
          value: function () {
            this.roamEntity && (this.roamEntity.show = !0),
              (this.clockSpeed = this.clockSpeed || 1),
              (this.viewer.clock.currentTime = this.startTime),
              (this.viewer.clock.multiplier = this.clockSpeed || 1),
              (this.viewer.clock.shouldAnimate = !0),
              (this.viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP),
              this.computeCamera();
          },
        },
        {
          key: "end",
          value: function () {
            this.roamEntity && (this.roamEntity.show = !1),
              (this.viewer.clock.currentTime = this.endTime),
              (this.viewer.clock.shouldAnimate = !1),
              (this.distanceED = this.alldistance),
              (this.timesED = this.alltimes),
              (this.viewer.trackedEntity = void 0),
              this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY),
              this.rendHandler &&
                (this.rendHandler(), (this.rendHandler = null)),
              this.endRoam && this.endRoam(this.opt);
          },
        },
        {
          key: "stop",
          value: function () {
            (this.stopTime = this.viewer.clock.currentTime.clone()),
              (this.viewer.clock.shouldAnimate = !1);
          },
        },
        {
          key: "goon",
          value: function () {
            this.stopTime &&
              ((this.viewer.clock.currentTime = this.stopTime.clone()),
              (this.viewer.clock.shouldAnimate = !0),
              (this.stopTime = null));
          },
        },
        {
          key: "setSpeed",
          value: function (speed) {
            (this.clockSpeed = speed),
              (this.viewer.clock.multiplier = this.clockSpeed);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.roamEntity &&
              (this.viewer.entities.remove(this.roamEntity),
              (this.roamEntity = null)),
              this.rendHandler &&
                (this.rendHandler(), (this.rendHandler = null)),
              (this.viewer.clock.multiplier = 1),
              (this.isLockView = !1),
              (this.viewer.trackedEntity = void 0),
              this.viewer.scene.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
          },
        },
        {
          key: "createRoamEntity",
          value: function (type, property) {
            var entity = null;
            if ("model" == type) {
              if (!this.opt.entityAttr || !this.opt.entityAttr.uri)
                return void console.log("漫游缺少模型对象！");
              entity = this.viewer.entities.add({
                orientation: new Cesium.VelocityOrientationProperty(property),
                position: property,
                model: this.opt.entityAttr,
              });
            } else if ("image" == type) {
              if (!this.opt.entityAttr || !this.opt.entityAttr.image)
                return void console.log("漫游缺少图片对象！");
              entity = this.viewer.entities.add({
                orientation: new Cesium.VelocityOrientationProperty(property),
                position: property,
                billboard: this.opt.entityAttr,
              });
            } else
              entity = this.viewer.entities.add({
                orientation: new Cesium.VelocityOrientationProperty(property),
                position: property,
                point: {
                  pixelSize: 0.001,
                  color: Cesium.Color.WHITE.withAlpha(1e-4),
                },
              });
            return (entity.show = !1), entity;
          },
        },
        {
          key: "transfromPositions",
          value: function (positions) {
            var newPositions;
            if (positions && !(positions.length < 1))
              return positions[0] instanceof Cesium.Cartesian3
                ? positions
                : ((newPositions = []),
                  positions.forEach(function (element) {
                    element = Cesium.Cartesian3.fromDegrees(
                      element[0],
                      element[1],
                      element[2] || 0
                    );
                    newPositions.push(element);
                  }),
                  newPositions);
          },
        },
        {
          key: "reversePositions",
          value: function (positions) {
            if (positions && !(positions.length < 1))
              return positions[0] instanceof Cesium.Cartesian3
                ? util$1.cartesiansToLnglats(positions, this.viewer)
                : positions;
          },
        },
        {
          key: "computeCamera",
          value: function () {
            var that = this,
              scratch = new Cesium.Matrix4(),
              lastPosition = ((this.distanceED = 0), (this.timeED = 0), null);
            this.rendHandler ||
              (this.rendHandler = this.viewer.scene.preRender.addEventListener(
                function (e) {
                  var currentTime;
                  that.viewer.clock.shouldAnimate &&
                    that.roamEntity &&
                    ((currentTime = that.viewer.clock.currentTime),
                    Cesium.JulianDate.compare(that.endTime, currentTime) < 0
                      ? that.end()
                      : (that.roaming &&
                          that.roaming(that.distanceED, that.timesED),
                        that.isLockView &&
                          (that.getModelMatrix(
                            that.roamEntity,
                            that.viewer.clock.currentTime,
                            scratch
                          ),
                          that.viewer.scene.camera.lookAtTransform(
                            scratch,
                            new Cesium.Cartesian3(
                              -that.viewXYZ.x,
                              that.viewXYZ.y,
                              that.viewXYZ.z
                            )
                          )),
                        (that.timeED = Cesium.JulianDate.secondsDifference(
                          currentTime,
                          that.startTime
                        )),
                        (currentTime =
                          that.roamEntity.position.getValue(currentTime)) &&
                          lastPosition &&
                          (that.distanceED += Cesium.Cartesian3.distance(
                            currentTime,
                            lastPosition
                          )),
                        (lastPosition = currentTime)));
                }
              ));
          },
        },
        {
          key: "getModelMatrix",
          value: function (entity, time, result) {
            if (entity) {
              var position = Cesium.Property.getValueOrUndefined(
                entity.position,
                time,
                new Cesium.Cartesian3()
              );
              if (Cesium.defined(position))
                return (entity = Cesium.Property.getValueOrUndefined(
                  entity.orientation,
                  time,
                  new Cesium.Quaternion()
                ))
                  ? Cesium.Matrix4.fromRotationTranslation(
                      Cesium.Matrix3.fromQuaternion(
                        entity,
                        new Cesium.Matrix3()
                      ),
                      position,
                      result
                    )
                  : Cesium.Transforms.eastNorthUpToFixedFrame(
                      position,
                      void 0,
                      result
                    );
            }
          },
        },
        {
          key: "createPropertyByTimes",
          value: function (positions, times) {
            if (positions && !(positions.length < 2)) {
              for (
                var property = new Cesium.SampledPositionProperty(),
                  alldistance = 0,
                  i = 1;
                i < positions.length;
                i++
              ) {
                var p = positions[i - 1],
                  nextP = positions[i];
                alldistance += Cesium.Cartesian3.distance(p, nextP);
              }
              for (
                var speed = alldistance / times, passdistance = 0, ind = 0;
                ind < positions.length;
                ind++
              ) {
                var lastP,
                  nowP = positions[ind],
                  currentTime = void 0;
                (currentTime =
                  0 == ind
                    ? this.startTime.clone()
                    : ((lastP = positions[ind - 1]),
                      (lastP =
                        (passdistance += Cesium.Cartesian3.distance(
                          nowP,
                          lastP
                        )) / speed),
                      Cesium.JulianDate.addSeconds(
                        this.startTime.clone(),
                        Number(lastP),
                        new Cesium.JulianDate()
                      ))),
                  property.addSample(currentTime.clone(), nowP.clone());
              }
              return {
                property: property,
                alldistance: alldistance,
                alltimes: times,
                speed: speed,
              };
            }
          },
        },
        {
          key: "createPropertyBySpeed",
          value: function (positions, speed) {
            if (positions && !(positions.length < 2)) {
              for (
                var property = new Cesium.SampledPositionProperty(),
                  alldistance = 0,
                  i = 1;
                i < positions.length;
                i++
              ) {
                var p = positions[i - 1],
                  nextP = positions[i];
                alldistance += Cesium.Cartesian3.distance(p, nextP);
              }
              for (
                var passdistance = 0, ind = 0;
                ind < positions.length;
                ind++
              ) {
                var lastP,
                  nowP = positions[ind],
                  currentTime = void 0;
                (currentTime =
                  0 == ind
                    ? this.startTime.clone()
                    : ((lastP = positions[ind - 1]),
                      (lastP =
                        (passdistance += Cesium.Cartesian3.distance(
                          nowP,
                          lastP
                        )) / speed),
                      Cesium.JulianDate.addSeconds(
                        this.startTime.clone(),
                        Number(lastP),
                        new Cesium.JulianDate()
                      ))),
                  property.addSample(currentTime.clone(), nowP.clone());
              }
              return {
                property: property,
                alldistance: alldistance,
                alltimes: alldistance / speed,
                speed: speed,
              };
            }
          },
        },
        {
          key: "setViewType",
          value: function (viewType, customXYZ) {
            switch (((this.viewType = viewType), this.viewType)) {
              case "dy":
                (this.isLockView = !0),
                  (this.viewXYZ = { x: 100, y: 0, z: 10 });
                break;
              case "sd":
                (this.isLockView = !0), (this.viewXYZ = { x: 0, y: 0, z: 5e3 });
                break;
              case "gs":
                (this.isLockView = !1),
                  (this.viewer.trackedEntity = this.roamEntity || void 0);
                break;
              case "custom":
                (this.isLockView = !0),
                  (this.viewXYZ = {
                    x: (customXYZ = customXYZ || {}).x || 600,
                    y: customXYZ.y || 0,
                    z: customXYZ.z || 150,
                  });
                break;
              default:
                (this.isLockView = !1),
                  (this.viewer.trackedEntity = void 0),
                  this.viewer.scene.camera.lookAtTransform(
                    Cesium.Matrix4.IDENTITY
                  );
            }
          },
        },
        {
          key: "setTrackView",
          value: function (viewXYZ) {
            (this.isLockView = !0), (this.viewXYZ = viewXYZ);
          },
        },
        {
          key: "getAttr",
          value: function () {
            var attr = {
              viewType: this.viewType,
              alldistance: this.alldistance,
              alltimes: this.alltimes,
              distanceED: this.distanceED,
              timeED: this.timeED,
              speed: this.speed,
              fixType: this.fixType,
              positions: this.reversePositions(this.positions, this.viewer),
              nowPosition: this.roamEntity
                ? this.roamEntity.position.getValue(
                    this.viewer.clock.currentTime
                  )
                : void 0,
            };
            return Object.assign(this.opt, attr);
          },
        },
      ]),
      Roam
    );
  })(),
  RoamTool = (function () {
    function RoamTool(viewer, opt) {
      _classCallCheck(this, RoamTool),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.startRoamFun = null),
        (this.endRoamFun = null),
        (this.roamingFun = null),
        (this.stopRoamFun = null),
        (this.goonRoamFun = null),
        (this.endCreateFun = null),
        (this.roamList = []),
        (this.nowStartRoam = null);
    }
    return (
      _createClass(RoamTool, [
        {
          key: "on",
          value: function (type, fun) {
            "startRoam" == type && (this.startRoamFun = fun),
              "endRoam" == type && (this.endRoamFun = fun),
              "roaming" == type && (this.roamingFun = fun),
              "stopRoam" == type && (this.stopRoamFun = fun),
              "goonRoam" == type && (this.goonRoamFun = fun),
              "endCreate" == type && (this.endCreateFun = fun);
          },
        },
        {
          key: "create",
          value: function (opt, callback) {
            var _opt = (opt = opt || {}),
              roamType = _opt.roamType,
              positions = this.transfromPositions(_opt.positions),
              roam = null,
              roamAttr = {
                alltimes: opt.alltimes,
                speed: opt.speed,
                endRoam: this.endRoamFun,
                roaming: this.roamingFun,
                viewType: opt.viewType,
              };
            opt.alltimes || opt.speed || (roamAttr.alltimes = 60),
              (roamAttr = Object.assign(opt, roamAttr));
            switch (Number(roamType)) {
              case 1:
                if (!opt.height) return void console.log("飞行漫游缺少高度！");
                var newPositions = this.updatePositionsHeight(
                  positions,
                  opt.height
                );
                (roamAttr.positions = newPositions),
                  ((roam = new Roam(this.viewer, roamAttr)).attr = roamAttr),
                  this.roamList.push(roam),
                  callback && callback(roam);
                break;
              case 2:
                roamAttr.entityAttr &&
                  (roamAttr.entityAttr.heightReference = 1),
                  ((roam = new Roam(this.viewer, roamAttr)).attr = roamAttr),
                  this.roamList.push(roam),
                  callback && callback(roam);
                break;
              case 3:
                break;
              default:
                (roamAttr.positions = positions),
                  ((roam = new Roam(this.viewer, roamAttr)).attr = roamAttr),
                  this.roamList.push(roam),
                  callback && callback(roam);
            }
            return roam;
          },
        },
        {
          key: "transfromPositions",
          value: function (positions) {
            var arr, newPositions;
            if (positions)
              return positions[0] instanceof Cesium.Cartesian3
                ? positions
                : positions[0].x && positions[0].y && positions[0].z
                ? ((arr = []),
                  positions.forEach(function (item) {
                    arr.push(new Cesium.Cartesian3(item.x, item.y, item.z));
                  }),
                  arr)
                : ((newPositions = []),
                  positions.forEach(function (element) {
                    element = Cesium.Cartesian3.fromDegrees(
                      element[0],
                      element[1],
                      element[2] || 0
                    );
                    newPositions.push(element);
                  }),
                  newPositions);
          },
        },
        {
          key: "updatePositionsHeight",
          value: function (positions, height) {
            var newPositions;
            return null == height
              ? positions
              : !positions || positions.length < 2
              ? void 0
              : ((newPositions = []),
                positions.forEach(function (position) {
                  (position = Cesium.Cartographic.fromCartesian(
                    position.clone()
                  )),
                    (position.height = Number(height)),
                    (position = Cesium.Cartographic.toCartesian(position));
                  newPositions.push(position);
                }),
                newPositions);
          },
        },
        {
          key: "getTerrainPositions",
          value: function (positions, callback) {
            if (positions && !(positions.length < 2)) {
              for (var cgArr = [], i = 0; i < positions.length; i++) {
                var cartesian = positions[i],
                  cartesian = Cesium.Cartographic.fromCartesian(cartesian);
                cgArr.push(cartesian);
              }
              var that = this;
              Cesium.sampleTerrainMostDetailed(
                this.viewer.terrainProvider,
                cgArr
              ).then(function (updateLnglats) {
                updateLnglats =
                  that.viewer.scene.globe.ellipsoid.cartographicArrayToCartesianArray(
                    updateLnglats
                  );
                callback && callback(updateLnglats);
              });
            }
          },
        },
        {
          key: "getRoamByField",
          value: function (fieldName, fieldValue) {
            if (!fieldName) return [];
            for (var arr = [], i = 0; i < this.roamList.length; i++) {
              var roam = this.roamList[i];
              roam.attr[fieldName] == fieldValue &&
                arr.push({ roam: roam, index: i });
            }
            return arr;
          },
        },
        {
          key: "removeRoamById",
          value: function (roamId) {
            if (roamId)
              for (var i = this.roamList.length - 1; 0 <= i; i--) {
                var roam = this.roamList[i];
                if (roam.objId == roamId) {
                  roam.destroy(), this.roamList.splice(i, 1);
                  break;
                }
              }
          },
        },
        {
          key: "removeRoam",
          value: function (roam) {
            roam && ((roam = roam.objId), this.removeRoamById(roam));
          },
        },
        {
          key: "startRoam",
          value: function (roam) {
            this.endRoam();
            for (
              var roamId = roam.objId, i = this.roamList.length - 1;
              0 <= i;
              i--
            ) {
              var _roam = this.roamList[i];
              if (_roam.objId == roamId) {
                _roam.start(),
                  (this.nowStartRoam = _roam),
                  this.startRoamFun && this.startRoamFun(_roam);
                break;
              }
            }
          },
        },
        {
          key: "endRoam",
          value: function () {
            this.nowStartRoam &&
              (this.nowStartRoam.end(), (this.nowStartRoam = null));
          },
        },
        {
          key: "getNowroamAttr",
          value: function () {
            return this.nowStartRoam
              ? Object.assign(
                  this.nowStartRoam.attr,
                  this.nowStartRoam.getAttr()
                )
              : {};
          },
        },
        {
          key: "destroy",
          value: function () {
            for (var i = this.roamList.length - 1; 0 <= i; i--)
              this.roamList[i].destroy();
            (this.roamList = []),
              (this.startRoamFun = null),
              (this.endRoamFun = null),
              (this.roamingFun = null),
              (this.stopRoamFun = null),
              (this.goonRoamFun = null),
              (this.endCreateFun = null);
          },
        },
        {
          key: "removeAll",
          value: function () {
            for (var i = this.roamList.length - 1; 0 <= i; i--)
              this.roamList[i].destroy();
            this.roamList = [];
          },
        },
        {
          key: "toJson",
          value: function () {
            for (var arr = [], i = this.roamList.length - 1; 0 <= i; i--) {
              var roam = this.roamList[i];
              arr.push(roam.getAttr());
            }
            return arr;
          },
        },
      ]),
      RoamTool
    );
  })(),
  CustomCriclePrimitive = (function () {
    function CustomCriclePrimitive(viewer, opt) {
      _classCallCheck(this, CustomCriclePrimitive),
        (this.viewer = viewer),
        (this.opt = opt || {});
      viewer = { radius: 1e3, speed: 1, color: Cesium.Color.WHITE };
      if (
        ((this.opt = Object.assign(viewer, this.opt)),
        (this.opt.color =
          this.opt.color instanceof Cesium.Color
            ? this.opt.color
            : Cesium.Color.fromCssColorString(this.opt.color)),
        this.opt.center)
      )
        return (
          this.opt.center instanceof Cesium.Cartesian3
            ? (this.position = this.opt.center)
            : (this.position = Cesium.Cartesian3.fromDegrees(
                this.opt.center[0],
                this.opt.center[1],
                this.opt.center[2] || 0
              )),
          (this._primitive = void 0),
          this.init(),
          this._primitive
        );
    }
    return (
      _createClass(CustomCriclePrimitive, [
        {
          key: "init",
          value: function () {
            var rectanglePosition = this.getCoorsByRadius(
                this.position,
                this.opt.radius
              ),
              rectanglePosition = new Cesium.RectangleGeometry({
                rectangle:
                  Cesium.Rectangle.fromCartesianArray(rectanglePosition),
                height: Cesium.Cartographic.fromCartesian(this.position.clone())
                  .height,
              });
            this._primitive = new Cesium.Primitive({
              geometryInstances: new Cesium.GeometryInstance({
                geometry: rectanglePosition,
              }),
              appearance: new Cesium.EllipsoidSurfaceAppearance({
                material: new Cesium.Material({
                  fabric: {
                    uniforms: {
                      image: this.opt.image || this.getImage(),
                      color: this.opt.color,
                      speed: this.opt.speed || 1,
                    },
                    source:
                      "\n                            uniform float angle;\n                            uniform sampler2D image;\n                            uniform vec4 color;\n                            czm_material czm_getMaterial(czm_materialInput materialInput)\n                            {\n                                czm_material material = czm_getDefaultMaterial(materialInput);\n                                float angle = mod((czm_frameNumber/100.0) * speed ,360.0);\n                                vec2 st = materialInput.st;\n                                st.x = st.x - 0.5;\n                                st.y = st.y - 0.5;\n                                if(st.x * st.x + st.y * st.y <= 0.25){\n                                    float x = st.x * cos(angle) - st.y * sin(angle);\n                                    float y = st.y * cos(angle) + st.x * sin(angle);\n                                    st.x = x + 0.5;\n                                    st.y = y + 0.5;\n                                } else {\n                                    st.x = st.x + 0.5;\n                                    st.y = st.y + 0.5;\n                                }\n                                material.diffuse = czm_gammaCorrect(texture(image, st).rgb * color.rgb);\n                                material.alpha = texture(image, st).a * color.a;\n                                material.emission = vec3(0.2);\n                                return material;\n                            }",
                  },
                }),
              }),
              asynchronous: !1,
            });
          },
        },
        {
          key: "getCoorsByRadius",
          value: function (center, radius) {
            if (center) {
              for (
                var trans = Cesium.Transforms.eastNorthUpToFixedFrame(
                    center.clone()
                  ),
                  trans_inverse = Cesium.Matrix4.inverse(
                    trans.clone(),
                    new Cesium.Matrix4()
                  ),
                  center_local = Cesium.Matrix4.multiplyByPoint(
                    trans_inverse,
                    center.clone(),
                    new Cesium.Cartesian3()
                  ),
                  y = new Cesium.Cartesian3(0, 1, 0),
                  newArr = [],
                  i = 45;
                i <= 360;
                i += 180
              ) {
                var roate_mtx = Cesium.Matrix3.fromRotationZ(
                    Cesium.Math.toRadians(i),
                    new Cesium.Matrix3()
                  ),
                  roate_mtx = Cesium.Matrix3.multiplyByVector(
                    roate_mtx,
                    y,
                    new Cesium.Cartesian3()
                  ),
                  roate_mtx =
                    (Cesium.Cartesian3.multiplyByScalar(
                      roate_mtx,
                      radius,
                      roate_mtx
                    ),
                    Cesium.Cartesian3.add(
                      center_local,
                      roate_mtx,
                      new Cesium.Cartesian3()
                    )),
                  roate_mtx = Cesium.Matrix4.multiplyByPoint(
                    trans,
                    roate_mtx.clone(),
                    new Cesium.Cartesian3()
                  );
                newArr.push(roate_mtx);
              }
              return newArr;
            }
          },
        },
        {
          key: "getImage",
          value: function () {
            var canvas = document.createElement("canvas"),
              context =
                ((canvas.width = 512),
                (canvas.height = 512),
                canvas.getContext("2d")),
              rg = context.createRadialGradient(256, 256, 0, 256, 256, 256);
            return (
              rg.addColorStop(0.1, "rgba(255, 255, 255, 1.0)"),
              rg.addColorStop(0.2, "rgba(255, 255, 255, 0.0)"),
              rg.addColorStop(0.3, "rgba(255, 255, 255, 0.9)"),
              rg.addColorStop(0.5, "rgba(255, 255, 255, 0.0)"),
              rg.addColorStop(0.9, "rgba(255, 255, 255, 0.2)"),
              rg.addColorStop(1, "rgba(255, 255, 255, 1.0)"),
              context.clearRect(0, 0, 512, 512),
              (context.strokeStyle = "rgb(255, 255, 255)"),
              context.setLineDash([80, 80]),
              (context.lineWidth = 30),
              context.arc(256, 256, 180, 0, 2 * Math.PI, !0),
              context.stroke(),
              context.beginPath(),
              context.arc(256, 256, 256, 0, 2 * Math.PI, !0),
              (context.fillStyle = rg),
              context.fill(),
              context.restore(),
              canvas
            );
          },
        },
      ]),
      CustomCriclePrimitive
    );
  })(),
  CustomWallPrimitive = (function () {
    function CustomWallPrimitive(viewer, opt) {
      _classCallCheck(this, CustomWallPrimitive),
        _defineProperty(this, "getGeometryValue", function () {
          var e =
              0 < arguments.length && void 0 !== arguments[0]
                ? arguments[0]
                : 1,
            t =
              1 < arguments.length && void 0 !== arguments[1]
                ? arguments[1]
                : 1,
            n =
              2 < arguments.length && void 0 !== arguments[2]
                ? arguments[2]
                : 1,
            a =
              3 < arguments.length && void 0 !== arguments[3]
                ? arguments[3]
                : 30,
            s = [e, 0],
            l = [t, 0],
            u = Cesium.Math.toRadians(360 / a),
            c = 1 / a,
            h = [],
            m = [0, 1, a + 1, 1, a + 2, a + 1],
            d = [];
          (h[0] = s[0]),
            (h[1] = s[1]),
            (h[2] = 0),
            (h[3 * (a + 1)] = l[0]),
            (h[3 * (a + 1) + 1] = l[1]),
            (h[3 * (a + 1) + 2] = n),
            (d[0] = 0),
            (d[1] = 0),
            (d[2 * (a + 1)] = 0);
          for (var _t, i, o, r, _e = (d[2 * (a + 1) + 1] = 1); _e <= a; _e++)
            (_t = u * _e),
              (i = c * _e),
              (o = s[0] * Math.cos(_t) - s[1] * Math.sin(_t)),
              (r = s[1] * Math.cos(_t) + s[0] * Math.sin(_t)),
              (h[3 * _e] = o),
              (h[3 * _e + 1] = r),
              (o = l[(h[3 * _e + 2] = 0)] * Math.cos(_t) - l[1] * Math.sin(_t)),
              (r = l[1] * Math.cos(_t) + l[0] * Math.sin(_t)),
              (h[3 * (a + 1) + 3 * _e] = o),
              (h[3 * (a + 1) + 3 * _e + 1] = r),
              (h[3 * (a + 1) + 3 * _e + 2] = n),
              (d[2 * _e] = i),
              (d[2 * _e + 1] = 0),
              (d[2 * (a + 1) + 2 * _e] = i),
              (d[2 * (a + 1) + 2 * _e + 1] = 1),
              m.push(_e, _e + 1, a + _e + 1, _e + 1, a + _e + 2, a + _e + 1);
          return { position: h, st: d, indices: m };
        }),
        (this.viewer = viewer),
        (this.opt = opt || {});
      viewer = {
        radius: 600,
        height: 200,
        speed: 2,
        number: 6,
        color: Cesium.Color.WHITE,
      };
      (this.opt = Object.assign(viewer, this.opt)),
        (this.opt.color =
          this.opt.color instanceof Cesium.Color
            ? this.opt.color
            : Cesium.Color.fromCssColorString(this.opt.color)),
        this.opt.center &&
          (this.opt.center instanceof Cesium.Cartesian3
            ? (this.position = this.opt.center)
            : (this.position = Cesium.Cartesian3.fromDegrees(
                this.opt.center[0],
                this.opt.center[1],
                this.opt.center[2] || 0
              )),
          (this.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
            this.position
          )),
          (this._primitive = void 0),
          (this.boundingSphere = new Cesium.BoundingSphere(
            new Cesium.Cartesian3(0, 0, 0),
            1
          )),
          (this.primitiveType = this.opt.primitiveType || "TRANGLES"),
          (this.step = 0));
    }
    return (
      _createClass(CustomWallPrimitive, [
        {
          key: "update",
          value: function (context, frameState, commandList) {
            this._primitive &&
              (this._primitive.destroy(), (this._primitive = void 0));
            var geoi = new Cesium.GeometryInstance({
              geometry: this.getGeometry(),
              modelMatrix: this.modelMatrix,
            });
            (this._primitive = new Cesium.Primitive({
              geometryInstances: geoi,
              appearance: this.getAppearance(),
              asynchronous: !1,
            })),
              this._primitive.update(context, frameState, commandList);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.primitive && this.viewer.scene.primitives.add(this.primitive);
          },
        },
        {
          key: "getGeometry",
          value: function () {
            (this.opt.speed += 0.003 * 1.5),
              (this.opt.speed = 1 < this.opt.speed ? 0 : this.opt.speed);
            var t = 0.5 * (1 - Math.cos(this.opt.speed * Math.PI * 2)),
              scale = [],
              geometryValue =
                ((scale[0] = scale[1] =
                  this.opt.radius *
                  (1 - Math.cos(this.opt.speed * Math.PI)) *
                  0.5),
                (scale[2] = this.opt.height * t),
                this.getGeometryValue(1, 1, 1, this.opt.number || 6));
            if (scale)
              for (var e = 0; e < geometryValue.position.length - 2; e += 3)
                (geometryValue.position[e] *= scale[0]),
                  (geometryValue.position[e + 1] *= scale[1]),
                  (geometryValue.position[e + 2] *= scale[2]);
            return new Cesium.Geometry({
              attributes: {
                position: new Cesium.GeometryAttribute({
                  componentDatatype: Cesium.ComponentDatatype.DOUBLE,
                  componentsPerAttribute: 3,
                  values: geometryValue.position,
                }),
                st: new Cesium.GeometryAttribute({
                  componentDatatype: Cesium.ComponentDatatype.FLOAT,
                  componentsPerAttribute: 2,
                  values: geometryValue.st,
                }),
              },
              indices: geometryValue.indices,
              primitiveType: Cesium.PrimitiveType[this.primitiveType],
              boundingSphere: this.boundingSphere,
            });
          },
        },
        {
          key: "getAppearance",
          value: function () {
            return new Cesium.EllipsoidSurfaceAppearance({
              material: new Cesium.Material({
                fabric: {
                  uniforms: { color: this.opt.color },
                  source:
                    "\n                        uniform vec4 color;\n                        czm_material czm_getMaterial(czm_materialInput materialInput){\n                            czm_material material = czm_getDefaultMaterial(materialInput);\n                            vec2 st = materialInput.st;\n                            material.diffuse = czm_gammaCorrect(color.rgb);\n                            material.alpha = color.a * pow(1.0 - st.t, 2.0);\n                            material.emission = vec3(0.2);\n                            return material;\n                        }\n                    ",
                },
              }),
              renderState: { cull: { enabled: !1 } },
            });
          },
        },
      ]),
      CustomWallPrimitive
    );
  })(),
  CustomCylinderPrimitive = (function () {
    function CustomCylinderPrimitive(viewer, opt) {
      _classCallCheck(this, CustomCylinderPrimitive),
        _defineProperty(this, "getGeometryValue", function () {
          var e =
              0 < arguments.length && void 0 !== arguments[0]
                ? arguments[0]
                : 1,
            t =
              1 < arguments.length && void 0 !== arguments[1]
                ? arguments[1]
                : 1,
            n =
              2 < arguments.length && void 0 !== arguments[2]
                ? arguments[2]
                : 1,
            a =
              3 < arguments.length && void 0 !== arguments[3]
                ? arguments[3]
                : 30,
            s = [e, 0],
            l = [t, 0],
            u = Cesium.Math.toRadians(360 / a),
            c = 1 / a,
            h = [],
            m = [0, 1, a + 1, 1, a + 2, a + 1],
            d = [];
          (h[0] = s[0]),
            (h[1] = s[1]),
            (h[2] = 0),
            (h[3 * (a + 1)] = l[0]),
            (h[3 * (a + 1) + 1] = l[1]),
            (h[3 * (a + 1) + 2] = n),
            (d[0] = 0),
            (d[1] = 0),
            (d[2 * (a + 1)] = 0);
          for (var _t, i, o, r, _e = (d[2 * (a + 1) + 1] = 1); _e <= a; _e++)
            (_t = u * _e),
              (i = c * _e),
              (o = s[0] * Math.cos(_t) - s[1] * Math.sin(_t)),
              (r = s[1] * Math.cos(_t) + s[0] * Math.sin(_t)),
              (h[3 * _e] = o),
              (h[3 * _e + 1] = r),
              (o = l[(h[3 * _e + 2] = 0)] * Math.cos(_t) - l[1] * Math.sin(_t)),
              (r = l[1] * Math.cos(_t) + l[0] * Math.sin(_t)),
              (h[3 * (a + 1) + 3 * _e] = o),
              (h[3 * (a + 1) + 3 * _e + 1] = r),
              (h[3 * (a + 1) + 3 * _e + 2] = n),
              (d[2 * _e] = i),
              (d[2 * _e + 1] = 0),
              (d[2 * (a + 1) + 2 * _e] = i),
              (d[2 * (a + 1) + 2 * _e + 1] = 1),
              m.push(_e, _e + 1, a + _e + 1, _e + 1, a + _e + 2, a + _e + 1);
          return { position: h, st: d, indices: m };
        }),
        (this.viewer = viewer),
        (this.opt = opt || {});
      (viewer = {
        radius: 10,
        length: 300,
        speed: 0,
        color: Cesium.Color.WHITE,
      }),
        (this.opt = Object.assign(viewer, this.opt)),
        (this.opt.color =
          this.opt.color instanceof Cesium.Color
            ? this.opt.color
            : Cesium.Color.fromCssColorString(this.opt.color)),
        this.opt.center instanceof Cesium.Cartesian3
          ? (this.position = this.opt.center.clone())
          : (this.position = Cesium.Cartesian3.fromDegrees(
              this.opt.center[0],
              this.opt.center[1],
              this.opt.center[2] || 0
            )),
        (this.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
          this.position
        )),
        (this._primitive = void 0),
        (this.boundingSphere = new Cesium.BoundingSphere(
          new Cesium.Cartesian3(0, 0, 0),
          1
        )),
        (this.primitiveType = this.opt.primitiveType || "TRANGLES"),
        (opt = new Cesium.GeometryInstance({
          geometry: this.getGeometry(),
          modelMatrix: this.modelMatrix,
        }));
      return (
        (this._primitive = new Cesium.Primitive({
          geometryInstances: opt,
          appearance: this.opt.image
            ? this.getImgAppearance()
            : this.getAppearance(),
          asynchronous: !1,
        })),
        this._primitive
      );
    }
    return (
      _createClass(CustomCylinderPrimitive, [
        {
          key: "destroy",
          value: function () {
            this.primitive && this.viewer.scene.primitives.add(this.primitive);
          },
        },
        {
          key: "getGeometry",
          value: function () {
            for (
              var scale = [this.opt.radius, this.opt.radius, this.opt.length],
                geometryValue = this.getGeometryValue(2, 0.3, 1, 10),
                e = 0;
              e < geometryValue.position.length - 2;
              e += 3
            )
              (geometryValue.position[e] *= scale[0]),
                (geometryValue.position[e + 1] *= scale[1]),
                (geometryValue.position[e + 2] *= scale[2]);
            return new Cesium.Geometry({
              attributes: {
                position: new Cesium.GeometryAttribute({
                  componentDatatype: Cesium.ComponentDatatype.DOUBLE,
                  componentsPerAttribute: 3,
                  values: geometryValue.position,
                }),
                st: new Cesium.GeometryAttribute({
                  componentDatatype: Cesium.ComponentDatatype.FLOAT,
                  componentsPerAttribute: 2,
                  values: geometryValue.st,
                }),
              },
              indices: geometryValue.indices,
              primitiveType: Cesium.PrimitiveType[this.opt.primitiveType],
              boundingSphere: this.boundingSphere,
            });
          },
        },
        {
          key: "getAppearance",
          value: function () {
            return new Cesium.EllipsoidSurfaceAppearance({
              material: new Cesium.Material({
                fabric: {
                  uniforms: { color: this.opt.color },
                  source:
                    "\n                        uniform vec4 color;\n                        czm_material czm_getMaterial(czm_materialInput materialInput){\n                            czm_material material = czm_getDefaultMaterial(materialInput);\n                            vec2 st = materialInput.st;\n                            float powerRatio = fract(czm_frameNumber / 30.0) + 1.0;\n                            float alpha = pow(1.0 - st.t, powerRatio);\n                            material.diffuse = czm_gammaCorrect(color.rgb);\n                            material.alpha = alpha * color.a;\n                            material.emission = vec3(0.2);\n                            return material;\n                        }\n                    ",
                },
              }),
              renderState: { cull: { enabled: !1 } },
            });
          },
        },
        {
          key: "getImgAppearance",
          value: function () {
            return new Cesium.EllipsoidSurfaceAppearance({
              material: new Cesium.Material({
                fabric: {
                  uniforms: {
                    image: this.opt.image,
                    color: Cesium.Color.WHITE,
                  },
                  source:
                    "\n                        uniform sampler2D image;\n                        uniform vec4 color;\n                        czm_material czm_getMaterial(czm_materialInput materialInput){\n                            czm_material material = czm_getDefaultMaterial(materialInput);\n                            vec2 v_st = materialInput.st;\n                            float dt = fract(czm_frameNumber / 90.0);\n                            vec2 st = fract(vec2(1.0) + v_st - vec2(dt, dt));\n                            vec4 imageColor = texture(image, st);\n                            vec3 diffuse = imageColor.rgb;\n                            float alpha = imageColor.a;\n                            diffuse *= color.rgb;\n                            alpha *= color.a;\n                            diffuse *= color.rgb;\n                            alpha *= color.a;\n                            material.diffuse = diffuse;\n                            material.alpha = alpha * pow(1.0 - v_st.t, 2.0);\n                            material.emission = vec3(0.2);\n                            return material;\n                        }\n                    ",
                },
              }),
              renderState: { cull: { enabled: !1 } },
            });
          },
        },
      ]),
      CustomCylinderPrimitive
    );
  })(),
  ConePrimitive = (function () {
    function ConePrimitive(viewer, opt) {
      _classCallCheck(this, ConePrimitive),
        (this.viewer = viewer),
        (this.position = (opt = opt || {}).position),
        (this.distance = opt.distance || 1e3),
        (this.direction = opt.direction || new Cesium.Cartesian3(1, 0, 0)),
        (this.fov = opt.fov || 60),
        (this.aspect = opt.aspect || 2),
        (this._primitive = void 0),
        (this.heading = opt.heading || 0),
        (this.pitch = opt.pitch || 0),
        (this.roll = opt.roll || 0),
        (this.positions = []),
        (this.rectangle = void 0),
        (this.outlineColor =
          opt.outlineColor || Cesium.Color.YELLOW.withAlpha(0.5)),
        (this.rectMaterial = opt.rectMaterial || Cesium.Color.YELLOW),
        (this.rectOnGround = null != opt.rectOnGround && opt.rectOnGround),
        (this.coneVisible = null == opt.coneVisible || opt.coneVisible),
        (this.rectangleVisible = opt.rectangleVisible),
        (this.stRotation = 0),
        (this._visible = !0);
    }
    return (
      _createClass(ConePrimitive, [
        {
          key: "getGeometry",
          value: function (dis, fov, aspect, primitiveType) {
            var positions = new Float64Array(15);
            fov = Cesium.Math.toRadians(fov / 2);
            (fov = Math.tan(fov) * dis),
              (aspect = fov / aspect),
              (positions[0] = 0.01),
              (positions[1] = 0.01),
              (positions[2] = 0.01),
              (positions[3] = +dis),
              (positions[4] = fov),
              (positions[5] = aspect),
              (positions[6] = +dis),
              (positions[7] = -1 * fov),
              (positions[8] = aspect),
              (positions[9] = +dis),
              (positions[10] = -1 * fov),
              (positions[11] = -1 * aspect),
              (positions[12] = +dis),
              (positions[13] = fov),
              (positions[14] = -1 * aspect),
              (dis = new Cesium.GeometryAttributes({
                position: new Cesium.GeometryAttribute({
                  componentDatatype: Cesium.ComponentDatatype.DOUBLE,
                  componentsPerAttribute: 3,
                  values: positions,
                }),
              })),
              (fov = new Uint16Array(18));
            return (
              (fov[0] = 0),
              (fov[1] = 1),
              (fov[2] = 0),
              (fov[3] = 2),
              (fov[4] = 0),
              (fov[5] = 3),
              (fov[6] = 0),
              (fov[7] = 4),
              (fov[8] = 1),
              (fov[9] = 2),
              (fov[10] = 2),
              (fov[11] = 3),
              (fov[12] = 3),
              (fov[13] = 4),
              (fov[14] = 4),
              (fov[15] = 1),
              new Cesium.Geometry({
                attributes: dis,
                indices: fov,
                primitiveType: Cesium.PrimitiveType.LINES,
                boundingSphere: Cesium.BoundingSphere.fromVertices(positions),
              })
            );
          },
        },
        {
          key: "update",
          value: function (context, frameState, commandList) {
            var headingPitchRoll,
              geometry = this.getGeometry(this.distance, this.fov, this.aspect);
            geometry &&
              (this._primitive &&
                (this._primitive.destroy(), (this._primitive = void 0)),
              (headingPitchRoll = new Cesium.HeadingPitchRoll(
                Cesium.Math.toRadians(this.heading),
                Cesium.Math.toRadians(this.pitch),
                Cesium.Math.toRadians(this.roll)
              )),
              (headingPitchRoll =
                Cesium.Transforms.headingPitchRollToFixedFrame(
                  this.position.clone(),
                  headingPitchRoll
                )),
              (this._primitive = new Cesium.Primitive({
                geometryInstances: new Cesium.GeometryInstance({
                  geometry: geometry,
                  attributes: {
                    color: Cesium.ColorGeometryInstanceAttribute.fromColor(
                      this.outlineColor
                    ),
                  },
                }),
                appearance: new Cesium.PerInstanceColorAppearance({
                  translucent: !0,
                  flat: !0,
                }),
                modelMatrix: headingPitchRoll,
                asynchronous: !1,
                show: this.coneVisible,
              })),
              this.rectangleVisible && this.updateRectangle(headingPitchRoll),
              this._primitive.update(context, frameState, commandList));
          },
        },
        {
          key: "updateRectangle",
          value: function (hprmtx) {
            this.hierarchy = [];
            var angle = Cesium.Math.toRadians(this.fov / 2),
              angle = Math.tan(angle) * this.distance,
              halfh = angle / this.aspect,
              modelMatrix_inverse = Cesium.Matrix4.inverse(
                hprmtx,
                new Cesium.Matrix4()
              ),
              modelMatrix_inverse = Cesium.Matrix4.multiplyByPoint(
                modelMatrix_inverse,
                this.position.clone(),
                new Cesium.Cartesian3()
              ),
              newP1 = new Cesium.Cartesian3(
                modelMatrix_inverse.x + this.distance,
                modelMatrix_inverse.y + angle,
                modelMatrix_inverse.z + halfh
              ),
              newP1 = Cesium.Matrix4.multiplyByPoint(
                hprmtx,
                newP1.clone(),
                new Cesium.Cartesian3()
              ),
              newP2 = new Cesium.Cartesian3(
                modelMatrix_inverse.x + this.distance,
                modelMatrix_inverse.y - angle,
                modelMatrix_inverse.z + halfh
              ),
              newP2 = Cesium.Matrix4.multiplyByPoint(
                hprmtx,
                newP2.clone(),
                new Cesium.Cartesian3()
              ),
              newP3 = new Cesium.Cartesian3(
                modelMatrix_inverse.x + this.distance,
                modelMatrix_inverse.y - angle,
                modelMatrix_inverse.z - halfh
              ),
              newP3 = Cesium.Matrix4.multiplyByPoint(
                hprmtx,
                newP3.clone(),
                new Cesium.Cartesian3()
              ),
              angle = new Cesium.Cartesian3(
                modelMatrix_inverse.x + this.distance,
                modelMatrix_inverse.y + angle,
                modelMatrix_inverse.z - halfh
              ),
              modelMatrix_inverse = Cesium.Matrix4.multiplyByPoint(
                hprmtx,
                angle.clone(),
                new Cesium.Cartesian3()
              ),
              that = this;
            (that.positions = [modelMatrix_inverse, newP3, newP2, newP1]),
              that.rectangle ||
                (that.rectangle = that.viewer.entities.add({
                  polygon: {
                    hierarchy: new Cesium.CallbackProperty(function () {
                      return new Cesium.PolygonHierarchy(that.positions);
                    }, !1),
                    material: this.rectMaterial,
                    perPositionHeight: !this.rectOnGround,
                  },
                  show: this.rectangleVisible,
                }));
          },
        },
        {
          key: "destroy",
          value: function () {
            this.rectangle &&
              (this.viewer.entities.remove(this.rectangle),
              (this.rectangle = void 0));
          },
        },
        {
          key: "setPosition",
          value: function (position) {
            this.position = position;
          },
        },
        {
          key: "setHeadingPitchRoll",
          value: function (heading, pitch, roll) {
            null != heading && (this.heading = heading),
              null != pitch && (this.pitch = pitch),
              null != roll && (this.roll = roll);
          },
        },
        {
          key: "setPolygonRotation",
          value: function (angle) {
            this.stRotation = angle || 0;
          },
        },
        {
          key: "visible",
          get: function () {
            return this.__visible;
          },
          set: function (visible) {
            (this.coneVisible = this.rectangleVisible = visible),
              (this._visible = visible),
              this.rectangle && (this.rectangle.show = visible);
          },
        },
      ]),
      ConePrimitive
    );
  })(),
  TrackCylinderGraphic = (function () {
    function TrackCylinderGraphic(opt) {
      var that;
      _classCallCheck(this, TrackCylinderGraphic),
        (this.opt = opt || {}),
        this.opt.startPosition && this.opt.endPosition
          ? ((this._startPosition =
              this.opt.startPosition instanceof Cesium.Cartesian3
                ? this.opt.startPosition
                : Cesium.Cartesian3.fromDegrees(
                    this._startPosition[0],
                    this._startPosition[1],
                    this._startPosition[2]
                  )),
            (this._endPosition =
              this.opt.endPosition instanceof Cesium.Cartesian3
                ? this.opt.endPosition
                : Cesium.Cartesian3.fromDegrees(
                    this._endPosition[0],
                    this._endPosition[1],
                    this._endPosition[2]
                  )),
            (opt = (that = this).opt.color || "#ffffff") instanceof
              Cesium.Color || (opt = Cesium.Color.fromCssColorString(opt)),
            (this.entity = new Cesium.Entity({
              position: new Cesium.CallbackProperty(function () {
                return Cesium.Cartesian3.midpoint(
                  that._startPosition.clone(),
                  that._endPosition.clone(),
                  new Cesium.Cartesian3()
                );
              }, !1),
              orientation: new Cesium.CallbackProperty(function () {
                var hpr = that.getHPR(that._startPosition, that._endPosition);
                return Cesium.Transforms.headingPitchRollQuaternion(
                  that._startPosition,
                  new Cesium.HeadingPitchRoll(
                    Cesium.Math.toRadians(hpr.heading),
                    Cesium.Math.toRadians(hpr.pitch - 90),
                    Cesium.Math.toRadians(hpr.roll)
                  )
                );
              }, !1),
              cylinder: {
                length: new Cesium.CallbackProperty(function () {
                  return Cesium.Cartesian3.distance(
                    that._startPosition.clone(),
                    that._endPosition.clone()
                  );
                }, !1),
                topRadius: this.opt.topRadius || 200,
                bottomRadius: this.opt.bottomRadius || 0,
                outline: this.opt.outline,
                numberOfVerticalLines: this.opt.numberOfVerticalLines || 8,
                outlineColor:
                  this.opt.outlineColor || Cesium.Color.BLACK.withAlpha(0.7),
                outlineWidth: this.opt.outlineWidth || 1,
                material: opt,
              },
            })))
          : console.log("缺少坐标信息");
    }
    return (
      _createClass(TrackCylinderGraphic, [
        {
          key: "startPosition",
          set: function (p) {
            p && (this._startPosition = p.clone());
          },
        },
        {
          key: "endPosition",
          set: function (p) {
            p && (this._endPosition = p.clone());
          },
        },
        {
          key: "getHPR",
          value: function (origin, end) {
            (end = Cesium.Cartesian3.subtract(
              end.clone(),
              origin.clone(),
              new Cesium.Cartesian3()
            )),
              (end = Cesium.Cartesian3.normalize(
                end.clone(),
                new Cesium.Cartesian3()
              )),
              (end = Cesium.Transforms.rotationMatrixFromPositionVelocity(
                origin,
                end,
                Cesium.Ellipsoid.WGS84
              )),
              (end = Cesium.Matrix4.fromRotationTranslation(end, origin)),
              (origin = Cesium.Transforms.eastNorthUpToFixedFrame(
                origin,
                Cesium.Ellipsoid.WGS84,
                new Cesium.Matrix4()
              )),
              (origin = Cesium.Matrix4.multiply(
                Cesium.Matrix4.inverse(origin, new Cesium.Matrix4()),
                end,
                new Cesium.Matrix4()
              )),
              (end = Cesium.Matrix4.getMatrix3(origin, new Cesium.Matrix3())),
              (origin = Cesium.Quaternion.fromRotationMatrix(end)),
              (end = Cesium.HeadingPitchRoll.fromQuaternion(origin));
            return {
              heading: Cesium.Math.toDegrees(end.heading),
              pitch: Cesium.Math.toDegrees(end.pitch),
              roll: Cesium.Math.toDegrees(end.roll),
            };
          },
        },
      ]),
      TrackCylinderGraphic
    );
  })(),
  fog = {
    fogProcs: null,
    isActivate: !1,
    fogVal: 0.1,
    viewer: void 0,
    activate: function (viewer) {
      (this.viewer = viewer || window.viewer),
        this.isActivate ||
          ((this.isActivate = !0),
          (viewer = this.initfog()),
          (this.fogProcs = new Cesium.PostProcessStage({
            name: "czm_fog",
            fragmentShader: viewer,
          })),
          this.viewer.scene.postProcessStages.add(this.fogProcs));
    },
    disable: function () {
      this.isActivate &&
        ((this.isActivate = !1),
        this.fogProcs &&
          (this.viewer.scene.postProcessStages.remove(this.fogProcs),
          this.fogProcs.destroy(),
          (this.fogProcs = null)));
    },
    initfog: function () {
      return (
        "  uniform sampler2D colorTexture;\n  uniform sampler2D depthTexture;\n  in vec2 v_textureCoordinates;\n  void main(void)\n  {\n      vec4 origcolor=texture(colorTexture, v_textureCoordinates);\n      vec4 fogcolor=vec4(0.8,0.8,0.8,0.2);\n\n      vec4 depthcolor = texture(depthTexture, v_textureCoordinates);\n\n      float f=(depthcolor.r-0.22)/" +
        (1 - this.fogVal) +
        ";\n      if(f<0.0) f=0.0;\n      else if(f>1.0) f=1.0;\n      out_FragColor = mix(origcolor,fogcolor,f);\n   }"
      );
    },
  },
  snow = {
    snowProcs: null,
    isActivate: !1,
    activate: function (viewer) {
      (this.viewer = viewer || window.viewer),
        this.isActivate ||
          ((this.isActivate = !0),
          (viewer = this.initSnow()),
          (this.snowProcs = new Cesium.PostProcessStage({
            name: "czm_snow",
            fragmentShader: viewer,
          })),
          this.viewer.scene.postProcessStages.add(this.snowProcs));
    },
    disable: function () {
      this.isActivate &&
        ((this.isActivate = !1),
        this.snowProcs &&
          (this.viewer.scene.postProcessStages.remove(this.snowProcs),
          (this.snowProcs = null)));
    },
    initSnow: function () {
      return "\n        uniform sampler2D colorTexture;\n        in vec2 v_textureCoordinates;\n        float snow(vec2 uv,float scale){\n            float time = czm_frameNumber / 60.0;\n            float w=smoothstep(1.,0.,-uv.y*(scale/10.));if(w<.1)return 0.;\n            uv+=time/scale;uv.y+=time*2./scale;uv.x+=sin(uv.y+time*.5)/scale;\n            uv*=scale;vec2 s=floor(uv),f=fract(uv),p;float k=3.,d;\n            p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;d=length(p);k=min(d,k);\n            k=smoothstep(0.,k,sin(f.x+f.y)*0.01);\n            return k*w;\n        }\n        \n        void main(void){\n            vec2 resolution = czm_viewport.zw;\n            vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n            vec3 finalColor=vec3(0);\n            float c = 0.0;\n            c+=snow(uv,30.)*.0;\n            c+=snow(uv,20.)*.0;\n            c+=snow(uv,15.)*.0;\n            c+=snow(uv,10.);\n            c+=snow(uv,8.);\n            c+=snow(uv,6.);\n            c+=snow(uv,5.);\n            finalColor=(vec3(c)); \n            out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3); \n        }\n        ";
    },
  },
  rain = {
    rainProcs: null,
    isActivate: !1,
    activate: function (viewer) {
      (this.viewer = viewer || window.viewer),
        this.isActivate ||
          ((this.isActivate = !0),
          (viewer = this.initRain()),
          (this.rainProcs = new Cesium.PostProcessStage({
            name: "czm_rain",
            fragmentShader: viewer,
          })),
          this.viewer.scene.postProcessStages.add(this.rainProcs));
    },
    disable: function () {
      this.isActivate &&
        ((this.isActivate = !1),
        this.rainProcs &&
          (this.viewer.scene.postProcessStages.remove(this.rainProcs),
          (this.rainProcs = null)));
    },
    initRain: function () {
      return "\n                uniform sampler2D colorTexture;\n                in vec2 v_textureCoordinates;\n                \n                float hash(float x){\n                    return fract(sin(x*23.3)*13.13);\n                }\n                \n                void main(void){\n                    float time = czm_frameNumber / 60.0;\n                    // czm_viewport表示当前窗口的尺寸\n                    vec2 resolution = czm_viewport.zw;\n                    // gl_FragCoord.xy表示当前窗口坐标,将当前坐标换算到以屏幕中心点为原点的坐标\n                    vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n                    vec3 c=vec3(1.0,1.0,1.0); // 设置雨水颜色\n                     \n                    float a = -.4;\n                    float si = sin(a);\n                    float co = cos(a);\n                    uv*=mat2(co,-si,si,co);\n                    uv*= 3.0;\n                    \n                    // 横向平铺\n                    float uvx = floor(uv.x*100.);\n                    float v=(1.-sin(hash(uvx)*2.))/2.0;\n\n                    float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;\n                    c*=v*b; \n                    out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c,1), 0.3);  \n                }\n        ";
    },
  },
  htmlTagRegex = /<html(.|\s)*>(.|\s)*<\/html>/im,
  KnockoutMarkdownBinding = {
    register: function (Knockout) {
      Knockout.bindingHandlers.markdown = {
        init: function () {
          return { controlsDescendantBindings: !0 };
        },
        update: function (element, valueAccessor) {
          for (; element.firstChild; ) Knockout.removeNode(element.firstChild);
          var html,
            valueAccessor = Knockout.unwrap(valueAccessor()),
            nodes =
              (htmlTagRegex.test(valueAccessor) && (html = valueAccessor),
              Knockout.utils.parseHtmlFragment(html, element));
          element.className = element.className + " markdown";
          for (var i = 0; i < nodes.length; ++i) {
            var node = nodes[i];
            setAnchorTargets(node), element.appendChild(node);
          }
        },
      };
    },
  };
function setAnchorTargets(element) {
  if (
    (element instanceof HTMLAnchorElement && (element.target = "_blank"),
    element.childNodes && 0 < element.childNodes.length)
  )
    for (var i = 0; i < element.childNodes.length; ++i)
      setAnchorTargets(element.childNodes[i]);
}
!(function (window, document, undefined$1) {
  var VENDOR_PREFIXES = ["", "webkit", "Moz", "MS", "ms", "o"],
    TEST_ELEMENT = document.createElement("div"),
    TYPE_FUNCTION = "function",
    round = Math.round,
    abs = Math.abs,
    now = Date.now;
  function setTimeoutContext(fn, timeout, context) {
    return setTimeout(bindFn(fn, context), timeout);
  }
  function invokeArrayArg(arg, fn, context) {
    return Array.isArray(arg) && (each(arg, context[fn], context), 1);
  }
  function each(obj, iterator, context) {
    if (obj)
      if (obj.forEach) obj.forEach(iterator, context);
      else if (obj.length !== undefined$1)
        for (i = 0; i < obj.length; )
          iterator.call(context, obj[i], i, obj), i++;
      else
        for (var i in obj)
          obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
  }
  function deprecate(method, name, message) {
    var deprecationMessage =
      "DEPRECATED METHOD: " + name + "\n" + message + " AT \n";
    return function () {
      var e = new Error("get-stack-trace"),
        e =
          e && e.stack
            ? e.stack
                .replace(/^[^\(]+?[\n$]/gm, "")
                .replace(/^\s+at\s+/gm, "")
                .replace(/^Object.<anonymous>\s*\(/gm, "{anonymous}()@")
            : "Unknown Stack Trace",
        log = window.console && (window.console.warn || window.console.log);
      return (
        log && log.call(window.console, deprecationMessage, e),
        method.apply(this, arguments)
      );
    };
  }
  var assign =
      "function" != typeof Object.assign
        ? function (target) {
            if (target === undefined$1 || null === target)
              throw new TypeError("Cannot convert undefined or null to object");
            for (
              var output = Object(target), index = 1;
              index < arguments.length;
              index++
            ) {
              var source = arguments[index];
              if (source !== undefined$1 && null !== source)
                for (var nextKey in source)
                  source.hasOwnProperty(nextKey) &&
                    (output[nextKey] = source[nextKey]);
            }
            return output;
          }
        : Object.assign,
    extend = deprecate(
      function (dest, src, merge) {
        for (var keys = Object.keys(src), i = 0; i < keys.length; )
          (merge && dest[keys[i]] !== undefined$1) ||
            (dest[keys[i]] = src[keys[i]]),
            i++;
        return dest;
      },
      "extend",
      "Use `assign`."
    ),
    merge = deprecate(
      function (dest, src) {
        return extend(dest, src, !0);
      },
      "merge",
      "Use `assign`."
    );
  function inherit(child, base, properties) {
    var base = base.prototype,
      childP = (child.prototype = Object.create(base));
    (childP.constructor = child),
      (childP._super = base),
      properties && assign(childP, properties);
  }
  function bindFn(fn, context) {
    return function () {
      return fn.apply(context, arguments);
    };
  }
  function boolOrFn(val, args) {
    return _typeof(val) == TYPE_FUNCTION
      ? val.apply((args && args[0]) || undefined$1, args)
      : val;
  }
  function ifUndefined(val1, val2) {
    return val1 === undefined$1 ? val2 : val1;
  }
  function addEventListeners(target, types, handler) {
    each(splitStr(types), function (type) {
      target.addEventListener(type, handler, !1);
    });
  }
  function removeEventListeners(target, types, handler) {
    each(splitStr(types), function (type) {
      target.removeEventListener(type, handler, !1);
    });
  }
  function hasParent(node, parent) {
    for (; node; ) {
      if (node == parent) return !0;
      node = node.parentNode;
    }
    return !1;
  }
  function inStr(str, find) {
    return -1 < str.indexOf(find);
  }
  function splitStr(str) {
    return str.trim().split(/\s+/g);
  }
  function inArray(src, find, findByKey) {
    if (src.indexOf && !findByKey) return src.indexOf(find);
    for (var i = 0; i < src.length; ) {
      if (
        (findByKey && src[i][findByKey] == find) ||
        (!findByKey && src[i] === find)
      )
        return i;
      i++;
    }
    return -1;
  }
  function toArray(obj) {
    return Array.prototype.slice.call(obj, 0);
  }
  function uniqueArray(src, key, sort) {
    for (var results = [], values = [], i = 0; i < src.length; ) {
      var val = key ? src[i][key] : src[i];
      inArray(values, val) < 0 && results.push(src[i]), (values[i] = val), i++;
    }
    return (results = sort
      ? key
        ? results.sort(function (a, b) {
            return a[key] > b[key];
          })
        : results.sort()
      : results);
  }
  function prefixed(obj, property) {
    for (
      var prefix,
        camelProp = property[0].toUpperCase() + property.slice(1),
        i = 0;
      i < VENDOR_PREFIXES.length;

    ) {
      if (
        (prefix = (prefix = VENDOR_PREFIXES[i])
          ? prefix + camelProp
          : property) in obj
      )
        return prefix;
      i++;
    }
    return undefined$1;
  }
  var _uniqueId = 1;
  function getWindowForElement(element) {
    element = element.ownerDocument || element;
    return element.defaultView || element.parentWindow || window;
  }
  var SUPPORT_TOUCH = "ontouchstart" in window,
    SUPPORT_POINTER_EVENTS = prefixed(window, "PointerEvent") !== undefined$1,
    SUPPORT_ONLY_TOUCH =
      SUPPORT_TOUCH &&
      /mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),
    COMPUTE_INTERVAL = 25,
    INPUT_START = 1,
    INPUT_END = 4,
    INPUT_CANCEL = 8,
    DIRECTION_NONE = 1,
    DIRECTION_LEFT = 2,
    DIRECTION_RIGHT = 4,
    DIRECTION_UP = 8,
    DIRECTION_DOWN = 16,
    DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT,
    DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN,
    DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
    PROPS_XY = ["x", "y"],
    PROPS_CLIENT_XY = ["clientX", "clientY"];
  function Input(manager, callback) {
    var self = this;
    (this.manager = manager),
      (this.callback = callback),
      (this.element = manager.element),
      (this.target = manager.options.inputTarget),
      (this.domHandler = function (ev) {
        boolOrFn(manager.options.enable, [manager]) && self.handler(ev);
      }),
      this.init();
  }
  function inputHandler(manager, eventType, input) {
    var pointersLen = input.pointers.length,
      changedPointersLen = input.changedPointers.length,
      isFirst =
        eventType & INPUT_START && pointersLen - changedPointersLen == 0,
      pointersLen =
        eventType & (INPUT_END | INPUT_CANCEL) &&
        pointersLen - changedPointersLen == 0;
    (input.isFirst = !!isFirst),
      (input.isFinal = !!pointersLen),
      isFirst && (manager.session = {}),
      (input.eventType = eventType),
      (function (manager, input) {
        var session = manager.session,
          pointers = input.pointers,
          pointersLength = pointers.length;
        session.firstInput ||
          (session.firstInput = simpleCloneInputData(input));
        1 < pointersLength && !session.firstMultiple
          ? (session.firstMultiple = simpleCloneInputData(input))
          : 1 === pointersLength && (session.firstMultiple = !1);
        var pointersLength = session.firstInput,
          firstMultiple = session.firstMultiple,
          offsetCenter = (firstMultiple || pointersLength).center,
          center = (input.center = getCenter(pointers)),
          pointersLength =
            ((input.timeStamp = now()),
            (input.deltaTime = input.timeStamp - pointersLength.timeStamp),
            (input.angle = getAngle(offsetCenter, center)),
            (input.distance = getDistance(offsetCenter, center)),
            (function (session, input) {
              var center = input.center,
                offset = session.offsetDelta || {},
                prevDelta = session.prevDelta || {},
                prevInput = session.prevInput || {};
              (input.eventType !== INPUT_START &&
                prevInput.eventType !== INPUT_END) ||
                ((prevDelta = session.prevDelta =
                  { x: prevInput.deltaX || 0, y: prevInput.deltaY || 0 }),
                (offset = session.offsetDelta = { x: center.x, y: center.y }));
              (input.deltaX = prevDelta.x + (center.x - offset.x)),
                (input.deltaY = prevDelta.y + (center.y - offset.y));
            })(session, input),
            (input.offsetDirection = getDirection(input.deltaX, input.deltaY)),
            getVelocity(input.deltaTime, input.deltaX, input.deltaY)),
          offsetCenter =
            ((input.overallVelocityX = pointersLength.x),
            (input.overallVelocityY = pointersLength.y),
            (input.overallVelocity =
              abs(pointersLength.x) > abs(pointersLength.y)
                ? pointersLength.x
                : pointersLength.y),
            (input.scale = firstMultiple
              ? (function (start, end) {
                  return (
                    getDistance(end[0], end[1], PROPS_CLIENT_XY) /
                    getDistance(start[0], start[1], PROPS_CLIENT_XY)
                  );
                })(firstMultiple.pointers, pointers)
              : 1),
            (input.rotation = firstMultiple
              ? (function (start, end) {
                  return (
                    getAngle(end[1], end[0], PROPS_CLIENT_XY) +
                    getAngle(start[1], start[0], PROPS_CLIENT_XY)
                  );
                })(firstMultiple.pointers, pointers)
              : 0),
            (input.maxPointers =
              !session.prevInput ||
              input.pointers.length > session.prevInput.maxPointers
                ? input.pointers.length
                : session.prevInput.maxPointers),
            (function (session, input) {
              var velocity,
                velocityX,
                velocityY,
                last = session.lastInterval || input,
                deltaTime = input.timeStamp - last.timeStamp;
              {
                var deltaX, deltaY;
                input.eventType != INPUT_CANCEL &&
                (COMPUTE_INTERVAL < deltaTime || last.velocity === undefined$1)
                  ? ((deltaX = input.deltaX - last.deltaX),
                    (deltaY = input.deltaY - last.deltaY),
                    (deltaTime = getVelocity(deltaTime, deltaX, deltaY)),
                    (velocityX = deltaTime.x),
                    (velocityY = deltaTime.y),
                    (velocity =
                      abs(deltaTime.x) > abs(deltaTime.y)
                        ? deltaTime.x
                        : deltaTime.y),
                    (deltaX = getDirection(deltaX, deltaY)),
                    (session.lastInterval = input))
                  : ((velocity = last.velocity),
                    (velocityX = last.velocityX),
                    (velocityY = last.velocityY),
                    (deltaX = last.direction));
              }
              (input.velocity = velocity),
                (input.velocityX = velocityX),
                (input.velocityY = velocityY),
                (input.direction = deltaX);
            })(session, input),
            manager.element);
        hasParent(input.srcEvent.target, offsetCenter) &&
          (offsetCenter = input.srcEvent.target);
        input.target = offsetCenter;
      })(manager, input),
      manager.emit("hammer.input", input),
      manager.recognize(input),
      (manager.session.prevInput = input);
  }
  function simpleCloneInputData(input) {
    for (var pointers = [], i = 0; i < input.pointers.length; )
      (pointers[i] = {
        clientX: round(input.pointers[i].clientX),
        clientY: round(input.pointers[i].clientY),
      }),
        i++;
    return {
      timeStamp: now(),
      pointers: pointers,
      center: getCenter(pointers),
      deltaX: input.deltaX,
      deltaY: input.deltaY,
    };
  }
  function getCenter(pointers) {
    var pointersLength = pointers.length;
    if (1 === pointersLength)
      return { x: round(pointers[0].clientX), y: round(pointers[0].clientY) };
    for (var x = 0, y = 0, i = 0; i < pointersLength; )
      (x += pointers[i].clientX), (y += pointers[i].clientY), i++;
    return { x: round(x / pointersLength), y: round(y / pointersLength) };
  }
  function getVelocity(deltaTime, x, y) {
    return { x: x / deltaTime || 0, y: y / deltaTime || 0 };
  }
  function getDirection(x, y) {
    return x === y
      ? DIRECTION_NONE
      : abs(x) >= abs(y)
      ? x < 0
        ? DIRECTION_LEFT
        : DIRECTION_RIGHT
      : y < 0
      ? DIRECTION_UP
      : DIRECTION_DOWN;
  }
  function getDistance(p1, p2, props) {
    var x = p2[(props = props || PROPS_XY)[0]] - p1[props[0]],
      p2 = p2[props[1]] - p1[props[1]];
    return Math.sqrt(x * x + p2 * p2);
  }
  function getAngle(p1, p2, props) {
    var x = p2[(props = props || PROPS_XY)[0]] - p1[props[0]],
      p2 = p2[props[1]] - p1[props[1]];
    return (180 * Math.atan2(p2, x)) / Math.PI;
  }
  Input.prototype = {
    handler: function () {},
    init: function () {
      this.evEl && addEventListeners(this.element, this.evEl, this.domHandler),
        this.evTarget &&
          addEventListeners(this.target, this.evTarget, this.domHandler),
        this.evWin &&
          addEventListeners(
            getWindowForElement(this.element),
            this.evWin,
            this.domHandler
          );
    },
    destroy: function () {
      this.evEl &&
        removeEventListeners(this.element, this.evEl, this.domHandler),
        this.evTarget &&
          removeEventListeners(this.target, this.evTarget, this.domHandler),
        this.evWin &&
          removeEventListeners(
            getWindowForElement(this.element),
            this.evWin,
            this.domHandler
          );
    },
  };
  var MOUSE_INPUT_MAP = {
    mousedown: INPUT_START,
    mousemove: 2,
    mouseup: INPUT_END,
  };
  function MouseInput() {
    (this.evEl = "mousedown"),
      (this.evWin = "mousemove mouseup"),
      (this.pressed = !1),
      Input.apply(this, arguments);
  }
  inherit(MouseInput, Input, {
    handler: function (ev) {
      var eventType = MOUSE_INPUT_MAP[ev.type];
      eventType & INPUT_START && 0 === ev.button && (this.pressed = !0),
        2 & eventType && 1 !== ev.which && (eventType = INPUT_END),
        this.pressed &&
          (eventType & INPUT_END && (this.pressed = !1),
          this.callback(this.manager, eventType, {
            pointers: [ev],
            changedPointers: [ev],
            pointerType: "mouse",
            srcEvent: ev,
          }));
    },
  });
  var POINTER_INPUT_MAP = {
      pointerdown: INPUT_START,
      pointermove: 2,
      pointerup: INPUT_END,
      pointercancel: INPUT_CANCEL,
      pointerout: INPUT_CANCEL,
    },
    IE10_POINTER_TYPE_ENUM = { 2: "touch", 3: "pen", 4: "mouse", 5: "kinect" },
    POINTER_ELEMENT_EVENTS = "pointerdown",
    POINTER_WINDOW_EVENTS = "pointermove pointerup pointercancel";
  function PointerEventInput() {
    (this.evEl = POINTER_ELEMENT_EVENTS),
      (this.evWin = POINTER_WINDOW_EVENTS),
      Input.apply(this, arguments),
      (this.store = this.manager.session.pointerEvents = []);
  }
  window.MSPointerEvent &&
    !window.PointerEvent &&
    ((POINTER_ELEMENT_EVENTS = "MSPointerDown"),
    (POINTER_WINDOW_EVENTS = "MSPointerMove MSPointerUp MSPointerCancel")),
    inherit(PointerEventInput, Input, {
      handler: function (ev) {
        var store = this.store,
          removePointer = !1,
          eventTypeNormalized = ev.type.toLowerCase().replace("ms", ""),
          eventTypeNormalized = POINTER_INPUT_MAP[eventTypeNormalized],
          pointerType =
            IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType,
          isTouch = "touch" == pointerType,
          storeIndex = inArray(store, ev.pointerId, "pointerId");
        eventTypeNormalized & INPUT_START && (0 === ev.button || isTouch)
          ? storeIndex < 0 && (store.push(ev), (storeIndex = store.length - 1))
          : eventTypeNormalized & (INPUT_END | INPUT_CANCEL) &&
            (removePointer = !0),
          storeIndex < 0 ||
            ((store[storeIndex] = ev),
            this.callback(this.manager, eventTypeNormalized, {
              pointers: store,
              changedPointers: [ev],
              pointerType: pointerType,
              srcEvent: ev,
            }),
            removePointer && store.splice(storeIndex, 1));
      },
    });
  var SINGLE_TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: 2,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL,
  };
  function SingleTouchInput() {
    (this.evTarget = "touchstart"),
      (this.evWin = "touchstart touchmove touchend touchcancel"),
      (this.started = !1),
      Input.apply(this, arguments);
  }
  inherit(SingleTouchInput, Input, {
    handler: function (ev) {
      var touches,
        type = SINGLE_TOUCH_INPUT_MAP[ev.type];
      type === INPUT_START && (this.started = !0),
        this.started &&
          ((touches = function (ev, type) {
            var all = toArray(ev.touches),
              ev = toArray(ev.changedTouches);
            type & (INPUT_END | INPUT_CANCEL) &&
              (all = uniqueArray(all.concat(ev), "identifier", !0));
            return [all, ev];
          }.call(this, ev, type)),
          type & (INPUT_END | INPUT_CANCEL) &&
            touches[0].length - touches[1].length == 0 &&
            (this.started = !1),
          this.callback(this.manager, type, {
            pointers: touches[0],
            changedPointers: touches[1],
            pointerType: "touch",
            srcEvent: ev,
          }));
    },
  });
  var TOUCH_INPUT_MAP = {
    touchstart: INPUT_START,
    touchmove: 2,
    touchend: INPUT_END,
    touchcancel: INPUT_CANCEL,
  };
  function TouchInput() {
    (this.evTarget = "touchstart touchmove touchend touchcancel"),
      (this.targetIds = {}),
      Input.apply(this, arguments);
  }
  inherit(TouchInput, Input, {
    handler: function (ev) {
      var type = TOUCH_INPUT_MAP[ev.type],
        touches = function (ev, type) {
          var allTouches = toArray(ev.touches),
            targetIds = this.targetIds;
          if (type & (2 | INPUT_START) && 1 === allTouches.length)
            return (
              (targetIds[allTouches[0].identifier] = !0),
              [allTouches, allTouches]
            );
          var i,
            targetTouches,
            changedTouches = toArray(ev.changedTouches),
            changedTargetTouches = [],
            target = this.target;
          if (
            ((targetTouches = allTouches.filter(function (touch) {
              return hasParent(touch.target, target);
            })),
            type === INPUT_START)
          )
            for (i = 0; i < targetTouches.length; )
              (targetIds[targetTouches[i].identifier] = !0), i++;
          i = 0;
          for (; i < changedTouches.length; )
            targetIds[changedTouches[i].identifier] &&
              changedTargetTouches.push(changedTouches[i]),
              type & (INPUT_END | INPUT_CANCEL) &&
                delete targetIds[changedTouches[i].identifier],
              i++;
          if (changedTargetTouches.length)
            return [
              uniqueArray(
                targetTouches.concat(changedTargetTouches),
                "identifier",
                !0
              ),
              changedTargetTouches,
            ];
        }.call(this, ev, type);
      touches &&
        this.callback(this.manager, type, {
          pointers: touches[0],
          changedPointers: touches[1],
          pointerType: "touch",
          srcEvent: ev,
        });
    },
  });
  var DEDUP_TIMEOUT = 2500;
  function TouchMouseInput() {
    Input.apply(this, arguments);
    var handler = bindFn(this.handler, this);
    (this.touch = new TouchInput(this.manager, handler)),
      (this.mouse = new MouseInput(this.manager, handler)),
      (this.primaryTouch = null),
      (this.lastTouches = []);
  }
  function setLastTouch(eventData) {
    var lastTouch,
      lts,
      eventData = eventData.changedPointers[0];
    eventData.identifier === this.primaryTouch &&
      ((lastTouch = { x: eventData.clientX, y: eventData.clientY }),
      this.lastTouches.push(lastTouch),
      (lts = this.lastTouches),
      setTimeout(function () {
        var i = lts.indexOf(lastTouch);
        -1 < i && lts.splice(i, 1);
      }, DEDUP_TIMEOUT));
  }
  inherit(TouchMouseInput, Input, {
    handler: function (manager, inputEvent, inputData) {
      var isTouch = "touch" == inputData.pointerType,
        isMouse = "mouse" == inputData.pointerType;
      if (
        !(
          isMouse &&
          inputData.sourceCapabilities &&
          inputData.sourceCapabilities.firesTouchEvents
        )
      ) {
        if (isTouch)
          !function (eventType, eventData) {
            eventType & INPUT_START
              ? ((this.primaryTouch = eventData.changedPointers[0].identifier),
                setLastTouch.call(this, eventData))
              : eventType & (INPUT_END | INPUT_CANCEL) &&
                setLastTouch.call(this, eventData);
          }.call(this, inputEvent, inputData);
        else if (
          isMouse &&
          function (eventData) {
            for (
              var x = eventData.srcEvent.clientX,
                y = eventData.srcEvent.clientY,
                i = 0;
              i < this.lastTouches.length;
              i++
            ) {
              var t = this.lastTouches[i],
                dx = Math.abs(x - t.x),
                t = Math.abs(y - t.y);
              if (dx <= 25 && t <= 25) return !0;
            }
            return !1;
          }.call(this, inputData)
        )
          return;
        this.callback(manager, inputEvent, inputData);
      }
    },
    destroy: function () {
      this.touch.destroy(), this.mouse.destroy();
    },
  });
  var touchMap,
    cssSupports,
    PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, "touchAction"),
    NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined$1,
    TOUCH_ACTION_MAP =
      NATIVE_TOUCH_ACTION &&
      ((touchMap = {}),
      (cssSupports = window.CSS && window.CSS.supports),
      ["auto", "manipulation", "pan-y", "pan-x", "pan-x pan-y", "none"].forEach(
        function (val) {
          touchMap[val] =
            !cssSupports || window.CSS.supports("touch-action", val);
        }
      ),
      touchMap);
  function TouchAction(manager, value) {
    (this.manager = manager), this.set(value);
  }
  TouchAction.prototype = {
    set: function (value) {
      "compute" == value && (value = this.compute()),
        NATIVE_TOUCH_ACTION &&
          this.manager.element.style &&
          TOUCH_ACTION_MAP[value] &&
          (this.manager.element.style[PREFIXED_TOUCH_ACTION] = value),
        (this.actions = value.toLowerCase().trim());
    },
    update: function () {
      this.set(this.manager.options.touchAction);
    },
    compute: function () {
      var actions = [];
      return (
        each(this.manager.recognizers, function (recognizer) {
          boolOrFn(recognizer.options.enable, [recognizer]) &&
            (actions = actions.concat(recognizer.getTouchAction()));
        }),
        (function (actions) {
          if (inStr(actions, "none")) return "none";
          var hasPanX = inStr(actions, "pan-x"),
            hasPanY = inStr(actions, "pan-y");
          if (hasPanX && hasPanY) return "none";
          if (hasPanX || hasPanY) return hasPanX ? "pan-x" : "pan-y";
          if (inStr(actions, "manipulation")) return "manipulation";
          return "auto";
        })(actions.join(" "))
      );
    },
    preventDefaults: function (input) {
      var srcEvent = input.srcEvent,
        direction = input.offsetDirection;
      if (!this.manager.session.prevented) {
        var actions = this.actions,
          hasNone = inStr(actions, "none") && !TOUCH_ACTION_MAP.none,
          hasPanY = inStr(actions, "pan-y") && !TOUCH_ACTION_MAP["pan-y"],
          actions = inStr(actions, "pan-x") && !TOUCH_ACTION_MAP["pan-x"];
        if (hasNone) {
          var isTapPointer = 1 === input.pointers.length,
            isTapMovement = input.distance < 2,
            input = input.deltaTime < 250;
          if (isTapPointer && isTapMovement && input) return;
        }
        return actions && hasPanY
          ? void 0
          : hasNone ||
            (hasPanY && direction & DIRECTION_HORIZONTAL) ||
            (actions && direction & DIRECTION_VERTICAL)
          ? this.preventSrc(srcEvent)
          : void 0;
      }
      srcEvent.preventDefault();
    },
    preventSrc: function (srcEvent) {
      (this.manager.session.prevented = !0), srcEvent.preventDefault();
    },
  };
  function Recognizer(options) {
    (this.options = assign({}, this.defaults, options || {})),
      (this.id = _uniqueId++),
      (this.manager = null),
      (this.options.enable = ifUndefined(this.options.enable, !0)),
      (this.state = 1),
      (this.simultaneous = {}),
      (this.requireFail = []);
  }
  function stateStr(state) {
    return 16 & state
      ? "cancel"
      : 8 & state
      ? "end"
      : 4 & state
      ? "move"
      : 2 & state
      ? "start"
      : "";
  }
  function directionStr(direction) {
    return direction == DIRECTION_DOWN
      ? "down"
      : direction == DIRECTION_UP
      ? "up"
      : direction == DIRECTION_LEFT
      ? "left"
      : direction == DIRECTION_RIGHT
      ? "right"
      : "";
  }
  function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
    recognizer = recognizer.manager;
    return recognizer ? recognizer.get(otherRecognizer) : otherRecognizer;
  }
  function AttrRecognizer() {
    Recognizer.apply(this, arguments);
  }
  function PanRecognizer() {
    AttrRecognizer.apply(this, arguments), (this.pX = null), (this.pY = null);
  }
  function PinchRecognizer() {
    AttrRecognizer.apply(this, arguments);
  }
  function PressRecognizer() {
    Recognizer.apply(this, arguments),
      (this._timer = null),
      (this._input = null);
  }
  function RotateRecognizer() {
    AttrRecognizer.apply(this, arguments);
  }
  function SwipeRecognizer() {
    AttrRecognizer.apply(this, arguments);
  }
  function TapRecognizer() {
    Recognizer.apply(this, arguments),
      (this.pTime = !1),
      (this.pCenter = !1),
      (this._timer = null),
      (this._input = null),
      (this.count = 0);
  }
  function Hammer(element, options) {
    return (
      ((options = options || {}).recognizers = ifUndefined(
        options.recognizers,
        Hammer.defaults.preset
      )),
      new Manager(element, options)
    );
  }
  (Recognizer.prototype = {
    defaults: {},
    set: function (options) {
      return (
        assign(this.options, options),
        this.manager && this.manager.touchAction.update(),
        this
      );
    },
    recognizeWith: function (otherRecognizer) {
      var simultaneous;
      return (
        invokeArrayArg(otherRecognizer, "recognizeWith", this) ||
          (simultaneous = this.simultaneous)[
            (otherRecognizer = getRecognizerByNameIfManager(
              otherRecognizer,
              this
            )).id
          ] ||
          (simultaneous[otherRecognizer.id] = otherRecognizer).recognizeWith(
            this
          ),
        this
      );
    },
    dropRecognizeWith: function (otherRecognizer) {
      return (
        invokeArrayArg(otherRecognizer, "dropRecognizeWith", this) ||
          ((otherRecognizer = getRecognizerByNameIfManager(
            otherRecognizer,
            this
          )),
          delete this.simultaneous[otherRecognizer.id]),
        this
      );
    },
    requireFailure: function (otherRecognizer) {
      var requireFail;
      return (
        invokeArrayArg(otherRecognizer, "requireFailure", this) ||
          (-1 ===
            inArray(
              (requireFail = this.requireFail),
              (otherRecognizer = getRecognizerByNameIfManager(
                otherRecognizer,
                this
              ))
            ) &&
            (requireFail.push(otherRecognizer),
            otherRecognizer.requireFailure(this))),
        this
      );
    },
    dropRequireFailure: function (otherRecognizer) {
      return (
        invokeArrayArg(otherRecognizer, "dropRequireFailure", this) ||
          ((otherRecognizer = getRecognizerByNameIfManager(
            otherRecognizer,
            this
          )),
          -1 < (otherRecognizer = inArray(this.requireFail, otherRecognizer)) &&
            this.requireFail.splice(otherRecognizer, 1)),
        this
      );
    },
    hasRequireFailures: function () {
      return 0 < this.requireFail.length;
    },
    canRecognizeWith: function (otherRecognizer) {
      return !!this.simultaneous[otherRecognizer.id];
    },
    emit: function (input) {
      var self = this,
        state = this.state;
      function emit(event) {
        self.manager.emit(event, input);
      }
      state < 8 && emit(self.options.event + stateStr(state)),
        emit(self.options.event),
        input.additionalEvent && emit(input.additionalEvent),
        8 <= state && emit(self.options.event + stateStr(state));
    },
    tryEmit: function (input) {
      if (this.canEmit()) return this.emit(input);
      this.state = 32;
    },
    canEmit: function () {
      for (var i = 0; i < this.requireFail.length; ) {
        if (!(33 & this.requireFail[i].state)) return !1;
        i++;
      }
      return !0;
    },
    recognize: function (inputData) {
      inputData = assign({}, inputData);
      boolOrFn(this.options.enable, [this, inputData])
        ? (56 & this.state && (this.state = 1),
          (this.state = this.process(inputData)),
          30 & this.state && this.tryEmit(inputData))
        : (this.reset(), (this.state = 32));
    },
    process: function (inputData) {},
    getTouchAction: function () {},
    reset: function () {},
  }),
    inherit(AttrRecognizer, Recognizer, {
      defaults: { pointers: 1 },
      attrTest: function (input) {
        var optionPointers = this.options.pointers;
        return 0 === optionPointers || input.pointers.length === optionPointers;
      },
      process: function (input) {
        var state = this.state,
          eventType = input.eventType,
          isRecognized = 6 & state,
          input = this.attrTest(input);
        return isRecognized && (eventType & INPUT_CANCEL || !input)
          ? 16 | state
          : isRecognized || input
          ? eventType & INPUT_END
            ? 8 | state
            : 2 & state
            ? 4 | state
            : 2
          : 32;
      },
    }),
    inherit(PanRecognizer, AttrRecognizer, {
      defaults: {
        event: "pan",
        threshold: 10,
        pointers: 1,
        direction: DIRECTION_ALL,
      },
      getTouchAction: function () {
        var direction = this.options.direction,
          actions = [];
        return (
          direction & DIRECTION_HORIZONTAL && actions.push("pan-y"),
          direction & DIRECTION_VERTICAL && actions.push("pan-x"),
          actions
        );
      },
      directionTest: function (input) {
        var options = this.options,
          hasMoved = !0,
          distance = input.distance,
          direction = input.direction,
          x = input.deltaX,
          y = input.deltaY;
        return (
          direction & options.direction ||
            (distance =
              options.direction & DIRECTION_HORIZONTAL
                ? ((direction =
                    0 === x
                      ? DIRECTION_NONE
                      : x < 0
                      ? DIRECTION_LEFT
                      : DIRECTION_RIGHT),
                  (hasMoved = x != this.pX),
                  Math.abs(input.deltaX))
                : ((direction =
                    0 === y
                      ? DIRECTION_NONE
                      : y < 0
                      ? DIRECTION_UP
                      : DIRECTION_DOWN),
                  (hasMoved = y != this.pY),
                  Math.abs(input.deltaY))),
          (input.direction = direction),
          hasMoved &&
            distance > options.threshold &&
            direction & options.direction
        );
      },
      attrTest: function (input) {
        return (
          AttrRecognizer.prototype.attrTest.call(this, input) &&
          (2 & this.state || (!(2 & this.state) && this.directionTest(input)))
        );
      },
      emit: function (input) {
        (this.pX = input.deltaX), (this.pY = input.deltaY);
        var direction = directionStr(input.direction);
        direction && (input.additionalEvent = this.options.event + direction),
          this._super.emit.call(this, input);
      },
    }),
    inherit(PinchRecognizer, AttrRecognizer, {
      defaults: { event: "pinch", threshold: 0, pointers: 2 },
      getTouchAction: function () {
        return ["none"];
      },
      attrTest: function (input) {
        return (
          this._super.attrTest.call(this, input) &&
          (Math.abs(input.scale - 1) > this.options.threshold || 2 & this.state)
        );
      },
      emit: function (input) {
        var inOut;
        1 !== input.scale &&
          ((inOut = input.scale < 1 ? "in" : "out"),
          (input.additionalEvent = this.options.event + inOut)),
          this._super.emit.call(this, input);
      },
    }),
    inherit(PressRecognizer, Recognizer, {
      defaults: { event: "press", pointers: 1, time: 251, threshold: 9 },
      getTouchAction: function () {
        return ["auto"];
      },
      process: function (input) {
        var options = this.options,
          validPointers = input.pointers.length === options.pointers,
          validMovement = input.distance < options.threshold,
          validTime = input.deltaTime > options.time;
        if (
          ((this._input = input),
          !validMovement ||
            !validPointers ||
            (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime))
        )
          this.reset();
        else if (input.eventType & INPUT_START)
          this.reset(),
            (this._timer = setTimeoutContext(
              function () {
                (this.state = 8), this.tryEmit();
              },
              options.time,
              this
            ));
        else if (input.eventType & INPUT_END) return 8;
        return 32;
      },
      reset: function () {
        clearTimeout(this._timer);
      },
      emit: function (input) {
        8 === this.state &&
          (input && input.eventType & INPUT_END
            ? this.manager.emit(this.options.event + "up", input)
            : ((this._input.timeStamp = now()),
              this.manager.emit(this.options.event, this._input)));
      },
    }),
    inherit(RotateRecognizer, AttrRecognizer, {
      defaults: { event: "rotate", threshold: 0, pointers: 2 },
      getTouchAction: function () {
        return ["none"];
      },
      attrTest: function (input) {
        return (
          this._super.attrTest.call(this, input) &&
          (Math.abs(input.rotation) > this.options.threshold || 2 & this.state)
        );
      },
    }),
    inherit(SwipeRecognizer, AttrRecognizer, {
      defaults: {
        event: "swipe",
        threshold: 10,
        velocity: 0.3,
        direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
        pointers: 1,
      },
      getTouchAction: function () {
        return PanRecognizer.prototype.getTouchAction.call(this);
      },
      attrTest: function (input) {
        var velocity,
          direction = this.options.direction;
        return (
          direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)
            ? (velocity = input.overallVelocity)
            : direction & DIRECTION_HORIZONTAL
            ? (velocity = input.overallVelocityX)
            : direction & DIRECTION_VERTICAL &&
              (velocity = input.overallVelocityY),
          this._super.attrTest.call(this, input) &&
            direction & input.offsetDirection &&
            input.distance > this.options.threshold &&
            input.maxPointers == this.options.pointers &&
            abs(velocity) > this.options.velocity &&
            input.eventType & INPUT_END
        );
      },
      emit: function (input) {
        var direction = directionStr(input.offsetDirection);
        direction && this.manager.emit(this.options.event + direction, input),
          this.manager.emit(this.options.event, input);
      },
    }),
    inherit(TapRecognizer, Recognizer, {
      defaults: {
        event: "tap",
        pointers: 1,
        taps: 1,
        interval: 300,
        time: 250,
        threshold: 9,
        posThreshold: 10,
      },
      getTouchAction: function () {
        return ["manipulation"];
      },
      process: function (input) {
        var options = this.options,
          validPointers = input.pointers.length === options.pointers,
          validMovement = input.distance < options.threshold,
          validTouchTime = input.deltaTime < options.time;
        if ((this.reset(), input.eventType & INPUT_START && 0 === this.count))
          return this.failTimeout();
        if (validMovement && validTouchTime && validPointers) {
          if (input.eventType != INPUT_END) return this.failTimeout();
          (validMovement =
            !this.pTime || input.timeStamp - this.pTime < options.interval),
            (validTouchTime =
              !this.pCenter ||
              getDistance(this.pCenter, input.center) < options.posThreshold);
          if (
            ((this.pTime = input.timeStamp),
            (this.pCenter = input.center),
            validTouchTime && validMovement
              ? (this.count += 1)
              : (this.count = 1),
            (this._input = input),
            0 == this.count % options.taps)
          )
            return this.hasRequireFailures()
              ? ((this._timer = setTimeoutContext(
                  function () {
                    (this.state = 8), this.tryEmit();
                  },
                  options.interval,
                  this
                )),
                2)
              : 8;
        }
        return 32;
      },
      failTimeout: function () {
        return (
          (this._timer = setTimeoutContext(
            function () {
              this.state = 32;
            },
            this.options.interval,
            this
          )),
          32
        );
      },
      reset: function () {
        clearTimeout(this._timer);
      },
      emit: function () {
        8 == this.state &&
          ((this._input.tapCount = this.count),
          this.manager.emit(this.options.event, this._input));
      },
    }),
    (Hammer.VERSION = "2.0.7"),
    (Hammer.defaults = {
      domEvents: !1,
      touchAction: "compute",
      enable: !0,
      inputTarget: null,
      inputClass: null,
      preset: [
        [RotateRecognizer, { enable: !1 }],
        [PinchRecognizer, { enable: !1 }, ["rotate"]],
        [SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }],
        [PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ["swipe"]],
        [TapRecognizer],
        [TapRecognizer, { event: "doubletap", taps: 2 }, ["tap"]],
        [PressRecognizer],
      ],
      cssProps: {
        userSelect: "none",
        touchSelect: "none",
        touchCallout: "none",
        contentZooming: "none",
        userDrag: "none",
        tapHighlightColor: "rgba(0,0,0,0)",
      },
    });
  function Manager(element, options) {
    (this.options = assign({}, Hammer.defaults, options || {})),
      (this.options.inputTarget = this.options.inputTarget || element),
      (this.handlers = {}),
      (this.session = {}),
      (this.recognizers = []),
      (this.oldCssProps = {}),
      (this.element = element),
      (this.input = new ((options = this).options.inputClass ||
        (SUPPORT_POINTER_EVENTS
          ? PointerEventInput
          : SUPPORT_ONLY_TOUCH
          ? TouchInput
          : SUPPORT_TOUCH
          ? TouchMouseInput
          : MouseInput))(options, inputHandler)),
      (this.touchAction = new TouchAction(this, this.options.touchAction)),
      toggleCssProps(this, !0),
      each(
        this.options.recognizers,
        function (item) {
          var recognizer = this.add(new item[0](item[1]));
          item[2] && recognizer.recognizeWith(item[2]),
            item[3] && recognizer.requireFailure(item[3]);
        },
        this
      );
  }
  function toggleCssProps(manager, add) {
    var prop,
      element = manager.element;
    element.style &&
      (each(manager.options.cssProps, function (value, name) {
        (prop = prefixed(element.style, name)),
          add
            ? ((manager.oldCssProps[prop] = element.style[prop]),
              (element.style[prop] = value))
            : (element.style[prop] = manager.oldCssProps[prop] || "");
      }),
      add || (manager.oldCssProps = {}));
  }
  (Manager.prototype = {
    set: function (options) {
      return (
        assign(this.options, options),
        options.touchAction && this.touchAction.update(),
        options.inputTarget &&
          (this.input.destroy(),
          (this.input.target = options.inputTarget),
          this.input.init()),
        this
      );
    },
    stop: function (force) {
      this.session.stopped = force ? 2 : 1;
    },
    recognize: function (inputData) {
      var session = this.session;
      if (!session.stopped) {
        this.touchAction.preventDefaults(inputData);
        for (
          var recognizer,
            recognizers = this.recognizers,
            curRecognizer = session.curRecognizer,
            i =
              ((!curRecognizer || 8 & curRecognizer.state) &&
                (curRecognizer = session.curRecognizer = null),
              0);
          i < recognizers.length;

        )
          (recognizer = recognizers[i]),
            2 === session.stopped ||
            (curRecognizer &&
              recognizer != curRecognizer &&
              !recognizer.canRecognizeWith(curRecognizer))
              ? recognizer.reset()
              : recognizer.recognize(inputData),
            !curRecognizer &&
              14 & recognizer.state &&
              (curRecognizer = session.curRecognizer = recognizer),
            i++;
      }
    },
    get: function (recognizer) {
      if (recognizer instanceof Recognizer) return recognizer;
      for (
        var recognizers = this.recognizers, i = 0;
        i < recognizers.length;
        i++
      )
        if (recognizers[i].options.event == recognizer) return recognizers[i];
      return null;
    },
    add: function (recognizer) {
      var existing;
      return invokeArrayArg(recognizer, "add", this)
        ? this
        : ((existing = this.get(recognizer.options.event)) &&
            this.remove(existing),
          this.recognizers.push(recognizer),
          (recognizer.manager = this).touchAction.update(),
          recognizer);
    },
    remove: function (recognizer) {
      var recognizers;
      return (
        !invokeArrayArg(recognizer, "remove", this) &&
          (recognizer = this.get(recognizer)) &&
          -1 !==
            (recognizer = inArray(
              (recognizers = this.recognizers),
              recognizer
            )) &&
          (recognizers.splice(recognizer, 1), this.touchAction.update()),
        this
      );
    },
    on: function (events, handler) {
      var handlers;
      if (events !== undefined$1 && handler !== undefined$1)
        return (
          (handlers = this.handlers),
          each(splitStr(events), function (event) {
            (handlers[event] = handlers[event] || []),
              handlers[event].push(handler);
          }),
          this
        );
    },
    off: function (events, handler) {
      var handlers;
      if (events !== undefined$1)
        return (
          (handlers = this.handlers),
          each(splitStr(events), function (event) {
            handler
              ? handlers[event] &&
                handlers[event].splice(inArray(handlers[event], handler), 1)
              : delete handlers[event];
          }),
          this
        );
    },
    emit: function (event, data) {
      this.options.domEvents &&
        !(function (event, data) {
          var gestureEvent = document.createEvent("Event");
          gestureEvent.initEvent(event, !0, !0),
            (gestureEvent.gesture = data).target.dispatchEvent(gestureEvent);
        })(event, data);
      var handlers = this.handlers[event] && this.handlers[event].slice();
      if (handlers && handlers.length) {
        (data.type = event),
          (data.preventDefault = function () {
            data.srcEvent.preventDefault();
          });
        for (var i = 0; i < handlers.length; ) handlers[i](data), i++;
      }
    },
    destroy: function () {
      this.element && toggleCssProps(this, !1),
        (this.handlers = {}),
        (this.session = {}),
        this.input.destroy(),
        (this.element = null);
    },
  }),
    assign(Hammer, {
      INPUT_START: INPUT_START,
      INPUT_MOVE: 2,
      INPUT_END: INPUT_END,
      INPUT_CANCEL: INPUT_CANCEL,
      STATE_POSSIBLE: 1,
      STATE_BEGAN: 2,
      STATE_CHANGED: 4,
      STATE_ENDED: 8,
      STATE_RECOGNIZED: 8,
      STATE_CANCELLED: 16,
      STATE_FAILED: 32,
      DIRECTION_NONE: DIRECTION_NONE,
      DIRECTION_LEFT: DIRECTION_LEFT,
      DIRECTION_RIGHT: DIRECTION_RIGHT,
      DIRECTION_UP: DIRECTION_UP,
      DIRECTION_DOWN: DIRECTION_DOWN,
      DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
      DIRECTION_VERTICAL: DIRECTION_VERTICAL,
      DIRECTION_ALL: DIRECTION_ALL,
      Manager: Manager,
      Input: Input,
      TouchAction: TouchAction,
      TouchInput: TouchInput,
      MouseInput: MouseInput,
      PointerEventInput: PointerEventInput,
      TouchMouseInput: TouchMouseInput,
      SingleTouchInput: SingleTouchInput,
      Recognizer: Recognizer,
      AttrRecognizer: AttrRecognizer,
      Tap: TapRecognizer,
      Pan: PanRecognizer,
      Swipe: SwipeRecognizer,
      Pinch: PinchRecognizer,
      Rotate: RotateRecognizer,
      Press: PressRecognizer,
      on: addEventListeners,
      off: removeEventListeners,
      each: each,
      merge: merge,
      extend: extend,
      assign: assign,
      inherit: inherit,
      bindFn: bindFn,
      prefixed: prefixed,
    }),
    ((void 0 !== window
      ? window
      : "undefined" != typeof self
      ? self
      : {}
    ).Hammer = Hammer),
    "function" == typeof define && define.amd
      ? define(function () {
          return Hammer;
        })
      : "undefined" != typeof module && module.exports
      ? (module.exports = Hammer)
      : (window.Hammer = Hammer);
})(window, document);
var Hammer = Object.freeze({ __proto__: null }),
  Cesium$1 = window.Cesium,
  knockout = Cesium$1.knockout,
  KnockoutHammerBinding = {
    register: function (Knockout) {
      (Knockout.bindingHandlers.swipeLeft = {
        init: function (
          element,
          valueAccessor,
          allBindings,
          viewModel,
          bindingContext
        ) {
          var f = Knockout.unwrap(valueAccessor());
          new Hammer(element).on("swipeleft", function (e) {
            var viewModel = bindingContext.$data;
            f.apply(viewModel, arguments);
          });
        },
      }),
        (Knockout.bindingHandlers.swipeRight = {
          init: function (
            element,
            valueAccessor,
            allBindings,
            viewModel,
            bindingContext
          ) {
            var f = Knockout.unwrap(valueAccessor());
            new Hammer(element).on("swiperight", function (e) {
              var viewModel = bindingContext.$data;
              f.apply(viewModel, arguments);
            });
          },
        });
    },
  },
  Cesium$2 = window.Cesium,
  knockout$1 = Cesium$2.knockout,
  SvgPathBindingHandler = Cesium$2.SvgPathBindingHandler,
  Knockout = knockout$1,
  registerKnockoutBindings = function () {
    SvgPathBindingHandler.register(Knockout),
      KnockoutMarkdownBinding.register(Knockout),
      KnockoutHammerBinding.register(Knockout),
      (Knockout.bindingHandlers.embeddedComponent = {
        init: function (
          element,
          valueAccessor,
          allBindings,
          viewModel,
          bindingContext
        ) {
          return (
            Knockout.unwrap(valueAccessor()).show(element),
            { controlsDescendantBindings: !0 }
          );
        },
        update: function (
          element,
          valueAccessor,
          allBindings,
          viewModel,
          bindingContext
        ) {},
      });
  },
  createFragmentFromTemplate = function (htmlString) {
    for (
      var holder = document.createElement("div"),
        fragment =
          ((holder.innerHTML = htmlString), document.createDocumentFragment());
      holder.firstChild;

    )
      fragment.appendChild(holder.firstChild);
    return fragment;
  },
  Cesium$3 = window.Cesium,
  knockout$2 = Cesium$3.knockout,
  getElement = Cesium$3.getElement,
  Knockout$1 = knockout$2,
  loadView = function (htmlString, container, viewModel) {
    container = getElement(container);
    for (
      var fragment = createFragmentFromTemplate(htmlString), nodes = [], i = 0;
      i < fragment.childNodes.length;
      ++i
    )
      nodes.push(fragment.childNodes[i]);
    for (container.appendChild(fragment), i = 0; i < nodes.length; ++i) {
      var node = nodes[i];
      (1 !== node.nodeType && 8 !== node.nodeType) ||
        Knockout$1.applyBindings(viewModel, node);
    }
    return nodes;
  },
  Cesium$4 = window.Cesium,
  defined = Cesium$4.defined,
  DeveloperError = Cesium$4.DeveloperError,
  EllipsoidGeodesic = Cesium$4.EllipsoidGeodesic,
  Cartesian2 = Cesium$4.Cartesian2,
  getTimestamp = Cesium$4.getTimestamp,
  EventHelper = Cesium$4.EventHelper,
  knockout$3 = Cesium$4.knockout,
  Knockout$2 = knockout$3,
  DistanceLegendViewModel = function (options) {
    if (!defined(options) || !defined(options.terria))
      throw new DeveloperError("options.terria is required.");
    (this.terria = options.terria),
      (this._removeSubscription = void 0),
      (this._lastLegendUpdate = void 0),
      (this.eventHelper = new EventHelper()),
      (this.distanceLabel = void 0),
      (this.barWidth = void 0),
      (this.enableDistanceLegend =
        !defined(options.enableDistanceLegend) || options.enableDistanceLegend),
      Knockout$2.track(this, ["distanceLabel", "barWidth"]),
      this.eventHelper.add(
        this.terria.afterWidgetChanged,
        function () {
          defined(this._removeSubscription) &&
            (this._removeSubscription(), (this._removeSubscription = void 0));
        },
        this
      );
    var that = this;
    function addUpdateSubscription() {
      var scene;
      defined(that.terria) &&
        ((scene = that.terria.scene),
        (that._removeSubscription = scene.postRender.addEventListener(
          function () {
            updateDistanceLegendCesium(this, scene);
          },
          that
        )));
    }
    addUpdateSubscription(),
      this.eventHelper.add(
        this.terria.afterWidgetChanged,
        function () {
          addUpdateSubscription();
        },
        this
      );
  },
  geodesic =
    ((DistanceLegendViewModel.prototype.destroy = function () {
      this.eventHelper.removeAll();
    }),
    (DistanceLegendViewModel.prototype.show = function (container) {
      var testing = this.enableDistanceLegend
        ? '<div class="distance-legend" id="vis3d-distance-legend" data-bind="visible: distanceLabel && barWidth"><div class="distance-legend-label" data-bind="text: distanceLabel"></div><div class="distance-legend-scale-bar" data-bind="style: { width: barWidth + \'px\', left: ((125 - barWidth) / 2) + \'px\' }"></div></div>'
        : '<div class="distance-legend" id="vis3d-distance-legend" style="display: none;" data-bind="visible: distanceLabel && barWidth"><div class="distance-legend-label"  data-bind="text: distanceLabel"></div><div class="distance-legend-scale-bar"  data-bind="style: { width: barWidth + \'px\', left: (5 + (125 - barWidth) / 2) + \'px\' }"></div></div>';
      loadView(testing, container, this);
    }),
    (DistanceLegendViewModel.create = function (options) {
      var result = new DistanceLegendViewModel(options);
      return (
        result.show(options.container), result.setStyle(options.style), result
      );
    }),
    (DistanceLegendViewModel.prototype.setStyle = function (style) {
      if (style && !(Object.keys(style).length < 1)) {
        var ele = document.getElementById("vis3d-distance-legend");
        if (ele) for (var i in style) ele.style[i] = style[i];
      }
    }),
    new EllipsoidGeodesic()),
  distances = [
    1, 2, 3, 5, 10, 20, 30, 50, 100, 200, 300, 500, 1e3, 2e3, 3e3, 5e3, 1e4,
    2e4, 3e4, 5e4, 1e5, 2e5, 3e5, 5e5, 1e6, 2e6, 3e6, 5e6, 1e7, 2e7, 3e7, 5e7,
  ];
function updateDistanceLegendCesium(viewModel, scene) {
  if (viewModel.enableDistanceLegend) {
    var now = getTimestamp();
    if (!(now < viewModel._lastLegendUpdate + 250)) {
      viewModel._lastLegendUpdate = now;
      var now = scene.canvas.clientWidth,
        height = scene.canvas.clientHeight,
        left = scene.camera.getPickRay(
          new Cartesian2((now / 2) | 0, height - 1)
        ),
        now = scene.camera.getPickRay(
          new Cartesian2((1 + now / 2) | 0, height - 1)
        ),
        height = scene.globe,
        left = height.pick(left, scene),
        now = height.pick(now, scene);
      if (defined(left) && defined(now)) {
        for (
          var distance,
            scene = height.ellipsoid.cartesianToCartographic(left),
            left = height.ellipsoid.cartesianToCartographic(now),
            pixelDistance =
              (geodesic.setEndPoints(scene, left), geodesic.surfaceDistance),
            i = distances.length - 1;
          !defined(distance) && 0 <= i;
          --i
        )
          distances[i] / pixelDistance < 100 && (distance = distances[i]);
        defined(distance)
          ? ((height =
              1e3 <= distance
                ? (distance / 1e3).toString() + " km"
                : distance.toString() + " m"),
            (viewModel.barWidth = (distance / pixelDistance) | 0),
            (viewModel.distanceLabel = height))
          : ((viewModel.barWidth = void 0), (viewModel.distanceLabel = void 0));
      } else (viewModel.barWidth = void 0), (viewModel.distanceLabel = void 0);
    }
  } else (viewModel.barWidth = void 0), (viewModel.distanceLabel = void 0);
}
var svgReset =
    "M 7.5,0 C 3.375,0 0,3.375 0,7.5 0,11.625 3.375,15 7.5,15 c 3.46875,0 6.375,-2.4375 7.21875,-5.625 l -1.96875,0 C 12,11.53125 9.9375,13.125 7.5,13.125 4.40625,13.125 1.875,10.59375 1.875,7.5 1.875,4.40625 4.40625,1.875 7.5,1.875 c 1.59375,0 2.90625,0.65625 3.9375,1.6875 l -3,3 6.5625,0 L 15,0 12.75,2.25 C 11.4375,0.84375 9.5625,0 7.5,0 z",
  Cesium$5 = window.Cesium,
  defined$1 = Cesium$5.defined,
  DeveloperError$1 = Cesium$5.DeveloperError,
  knockout$4 = Cesium$5.knockout,
  Knockout$3 = knockout$4,
  UserInterfaceControl = function (terria) {
    if (!defined$1(terria)) throw new DeveloperError$1("terria is required");
    (this._terria = terria),
      (this.name = "Unnamed Control"),
      (this.text = void 0),
      (this.svgIcon = void 0),
      (this.svgHeight = void 0),
      (this.svgWidth = void 0),
      (this.cssClass = void 0),
      (this.isActive = !1),
      Knockout$3.track(this, [
        "name",
        "svgIcon",
        "svgHeight",
        "svgWidth",
        "cssClass",
        "isActive",
      ]);
  },
  NavigationControl =
    (Object.defineProperties(UserInterfaceControl.prototype, {
      terria: {
        get: function () {
          return this._terria;
        },
      },
      hasText: {
        get: function () {
          return defined$1(this.text) && "string" == typeof this.text;
        },
      },
    }),
    (UserInterfaceControl.prototype.activate = function () {
      throw new DeveloperError$1(
        "activate must be implemented in the derived class."
      );
    }),
    function (terria) {
      UserInterfaceControl.apply(this, arguments);
    }),
  Cesium$6 =
    ((NavigationControl.prototype = Object.create(
      UserInterfaceControl.prototype
    )),
    window.Cesium),
  defined$2 = Cesium$6.defined,
  Camera = Cesium$6.Camera,
  Rectangle = Cesium$6.Rectangle,
  Cartographic = Cesium$6.Cartographic,
  Math$1 = Cesium$6.Math,
  ResetViewNavigationControl = function (terria) {
    NavigationControl.apply(this, arguments),
      (this.name = "重置视图"),
      (this.navigationLocked = !1),
      (this.svgIcon = svgReset),
      (this.svgHeight = 15),
      (this.svgWidth = 15),
      (this.cssClass = "navigation-control-icon-reset");
  },
  Cesium$7 =
    ((ResetViewNavigationControl.prototype = Object.create(
      NavigationControl.prototype
    )),
    (ResetViewNavigationControl.prototype.setNavigationLocked = function (
      locked
    ) {
      this.navigationLocked = locked;
    }),
    (ResetViewNavigationControl.prototype.resetView = function () {
      var scene, trackedEntity;
      this.navigationLocked ||
        ((scene = this.terria.scene).screenSpaceCameraController.enableInputs &&
          ((this.isActive = !0),
          (scene = scene.camera),
          defined$2(this.terria.trackedEntity)
            ? ((trackedEntity = this.terria.trackedEntity),
              (this.terria.trackedEntity = void 0),
              (this.terria.trackedEntity = trackedEntity))
            : this.terria.options.view
            ? this.setCameraView(this.terria.options.view, this.terria)
            : "function" == typeof scene.flyHome
            ? scene.flyHome(1)
            : scene.flyTo({
                destination: Camera.DEFAULT_VIEW_RECTANGLE,
                duration: 1,
              }),
          (this.isActive = !1)));
    }),
    (ResetViewNavigationControl.prototype.activate = function () {
      this.resetView();
    }),
    (ResetViewNavigationControl.prototype.setCameraView = function (
      obj,
      mapViewer
    ) {
      var position,
        mapViewer = mapViewer || window.viewer;
      obj &&
        ((position =
          obj.destination ||
          Cesium$6.Cartesian3.fromDegrees(obj.x, obj.y, obj.z)),
        mapViewer.camera.flyTo({
          destination: position,
          orientation: {
            heading: Cesium$6.Math.toRadians(obj.heading || 0),
            pitch: Cesium$6.Math.toRadians(obj.pitch || 0),
            roll: Cesium$6.Math.toRadians(obj.roll || 0),
          },
          duration: void 0 === obj.duration ? 3 : obj.duration,
          complete: obj.complete,
        }));
    }),
    window.Cesium),
  defined$3 = Cesium$7.defined,
  Ray = Cesium$7.Ray,
  Cartesian3 = Cesium$7.Cartesian3,
  Cartographic$1 = Cesium$7.Cartographic,
  ReferenceFrame = Cesium$7.ReferenceFrame,
  SceneMode = Cesium$7.SceneMode,
  Utils = {},
  unprojectedScratch = new Cartographic$1(),
  rayScratch = new Ray(),
  Cesium$8 =
    ((Utils.getCameraFocus = function (terria, inWorldCoordinates, result) {
      var scene = terria.scene,
        camera = scene.camera;
      if (
        scene.mode !== SceneMode.MORPHING &&
        (defined$3(result) || (result = new Cartesian3()),
        (result = defined$3(terria.trackedEntity)
          ? terria.trackedEntity.position.getValue(
              terria.clock.currentTime,
              result
            )
          : ((rayScratch.origin = camera.positionWC),
            (rayScratch.direction = camera.directionWC),
            scene.globe.pick(rayScratch, scene, result))),
        defined$3(result))
      )
        return (
          scene.mode === SceneMode.SCENE2D ||
          scene.mode === SceneMode.COLUMBUS_VIEW
            ? ((result = camera.worldToCameraCoordinatesPoint(result, result)),
              inWorldCoordinates &&
                (result = scene.globe.ellipsoid.cartographicToCartesian(
                  scene.mapProjection.unproject(result, unprojectedScratch),
                  result
                )))
            : inWorldCoordinates ||
              (result = camera.worldToCameraCoordinatesPoint(result, result)),
          result
        );
    }),
    window.Cesium),
  defined$4 = Cesium$8.defined,
  Ray$1 = Cesium$8.Ray,
  IntersectionTests = Cesium$8.IntersectionTests,
  Cartesian3$1 = Cesium$8.Cartesian3,
  SceneMode$1 = Cesium$8.SceneMode,
  ZoomNavigationControl = function (terria, zoomIn) {
    NavigationControl.apply(this, arguments),
      (this.name = "视图 " + (zoomIn ? "放大" : "缩小")),
      (this.text = zoomIn ? "+" : "-"),
      (this.cssClass =
        "navigation-control-icon-zoom-" + (zoomIn ? "in" : "out")),
      (this.relativeAmount = 2),
      zoomIn && (this.relativeAmount = 1 / this.relativeAmount);
  },
  cartesian3Scratch =
    ((ZoomNavigationControl.prototype.relativeAmount = 1),
    (ZoomNavigationControl.prototype = Object.create(
      NavigationControl.prototype
    )),
    (ZoomNavigationControl.prototype.activate = function () {
      this.zoom(this.relativeAmount);
    }),
    new Cartesian3$1()),
  svgCompassOuterRing =
    ((ZoomNavigationControl.prototype.zoom = function (relativeAmount) {
      if (((this.isActive = !0), defined$4(this.terria))) {
        var scene = this.terria.scene,
          sscc = scene.screenSpaceCameraController;
        if (!sscc.enableInputs || !sscc.enableZoom) return;
        var camera = scene.camera;
        switch (scene.mode) {
          case SceneMode$1.MORPHING:
            break;
          case SceneMode$1.SCENE2D:
            camera.zoomIn(
              camera.positionCartographic.height * (1 - this.relativeAmount)
            );
            break;
          default:
            (focus = defined$4(this.terria.trackedEntity)
              ? new Cartesian3$1()
              : Utils.getCameraFocus(this.terria, !1)),
              (ray = defined$4(focus)
                ? { direction: camera.direction, up: camera.up }
                : ((ray = new Ray$1(
                    camera.worldToCameraCoordinatesPoint(
                      scene.globe.ellipsoid.cartographicToCartesian(
                        camera.positionCartographic
                      )
                    ),
                    camera.directionWC
                  )),
                  (focus = IntersectionTests.grazingAltitudeLocation(
                    ray,
                    scene.globe.ellipsoid
                  )),
                  {
                    heading: camera.heading,
                    pitch: camera.pitch,
                    roll: camera.roll,
                  }));
            var focus,
              ray,
              direction = Cartesian3$1.subtract(
                camera.position,
                focus,
                cartesian3Scratch
              ),
              direction = Cartesian3$1.multiplyByScalar(
                direction,
                relativeAmount,
                direction
              ),
              direction = Cartesian3$1.add(focus, direction, focus);
            defined$4(this.terria.trackedEntity) ||
            scene.mode === SceneMode$1.COLUMBUS_VIEW
              ? (camera.position = direction)
              : camera.flyTo({
                  destination: direction,
                  orientation: ray,
                  duration: 0.5,
                  convert: !1,
                });
        }
      }
      this.isActive = !1;
    }),
    "m 66.5625,0 0,15.15625 3.71875,0 0,-10.40625 5.5,10.40625 4.375,0 0,-15.15625 -3.71875,0 0,10.40625 L 70.9375,0 66.5625,0 z M 72.5,20.21875 c -28.867432,0 -52.28125,23.407738 -52.28125,52.28125 0,28.87351 23.413818,52.3125 52.28125,52.3125 28.86743,0 52.28125,-23.43899 52.28125,-52.3125 0,-28.873512 -23.41382,-52.28125 -52.28125,-52.28125 z m 0,1.75 c 13.842515,0 26.368948,5.558092 35.5,14.5625 l -11.03125,11 0.625,0.625 11.03125,-11 c 8.9199,9.108762 14.4375,21.579143 14.4375,35.34375 0,13.764606 -5.5176,26.22729 -14.4375,35.34375 l -11.03125,-11 -0.625,0.625 11.03125,11 c -9.130866,9.01087 -21.658601,14.59375 -35.5,14.59375 -13.801622,0 -26.321058,-5.53481 -35.4375,-14.5 l 11.125,-11.09375 c 6.277989,6.12179 14.857796,9.90625 24.3125,9.90625 19.241896,0 34.875,-15.629154 34.875,-34.875 0,-19.245847 -15.633104,-34.84375 -34.875,-34.84375 -9.454704,0 -18.034511,3.760884 -24.3125,9.875 L 37.0625,36.4375 C 46.179178,27.478444 58.696991,21.96875 72.5,21.96875 z m -0.875,0.84375 0,13.9375 1.75,0 0,-13.9375 -1.75,0 z M 36.46875,37.0625 47.5625,48.15625 C 41.429794,54.436565 37.65625,63.027539 37.65625,72.5 c 0,9.472461 3.773544,18.055746 9.90625,24.34375 L 36.46875,107.9375 c -8.96721,-9.1247 -14.5,-21.624886 -14.5,-35.4375 0,-13.812615 5.53279,-26.320526 14.5,-35.4375 z M 72.5,39.40625 c 18.297686,0 33.125,14.791695 33.125,33.09375 0,18.302054 -14.827314,33.125 -33.125,33.125 -18.297687,0 -33.09375,-14.822946 -33.09375,-33.125 0,-18.302056 14.796063,-33.09375 33.09375,-33.09375 z M 22.84375,71.625 l 0,1.75 13.96875,0 0,-1.75 -13.96875,0 z m 85.5625,0 0,1.75 14,0 0,-1.75 -14,0 z M 71.75,108.25 l 0,13.9375 1.71875,0 0,-13.9375 -1.71875,0 z"),
  svgCompassGyro =
    "m 72.71875,54.375 c -0.476702,0 -0.908208,0.245402 -1.21875,0.5625 -0.310542,0.317098 -0.551189,0.701933 -0.78125,1.1875 -0.172018,0.363062 -0.319101,0.791709 -0.46875,1.25 -6.91615,1.075544 -12.313231,6.656514 -13,13.625 -0.327516,0.117495 -0.661877,0.244642 -0.9375,0.375 -0.485434,0.22959 -0.901634,0.471239 -1.21875,0.78125 -0.317116,0.310011 -0.5625,0.742111 -0.5625,1.21875 l 0.03125,0 c 0,0.476639 0.245384,0.877489 0.5625,1.1875 0.317116,0.310011 0.702066,0.58291 1.1875,0.8125 0.35554,0.168155 0.771616,0.32165 1.21875,0.46875 1.370803,6.10004 6.420817,10.834127 12.71875,11.8125 0.146999,0.447079 0.30025,0.863113 0.46875,1.21875 0.230061,0.485567 0.470708,0.870402 0.78125,1.1875 0.310542,0.317098 0.742048,0.5625 1.21875,0.5625 0.476702,0 0.876958,-0.245402 1.1875,-0.5625 0.310542,-0.317098 0.582439,-0.701933 0.8125,-1.1875 0.172018,-0.363062 0.319101,-0.791709 0.46875,-1.25 6.249045,-1.017063 11.256351,-5.7184 12.625,-11.78125 0.447134,-0.1471 0.86321,-0.300595 1.21875,-0.46875 0.485434,-0.22959 0.901633,-0.502489 1.21875,-0.8125 0.317117,-0.310011 0.5625,-0.710861 0.5625,-1.1875 l -0.03125,0 c 0,-0.476639 -0.245383,-0.908739 -0.5625,-1.21875 C 89.901633,71.846239 89.516684,71.60459 89.03125,71.375 88.755626,71.244642 88.456123,71.117495 88.125,71 87.439949,64.078341 82.072807,58.503735 75.21875,57.375 c -0.15044,-0.461669 -0.326927,-0.884711 -0.5,-1.25 -0.230061,-0.485567 -0.501958,-0.870402 -0.8125,-1.1875 -0.310542,-0.317098 -0.710798,-0.5625 -1.1875,-0.5625 z m -0.0625,1.40625 c 0.03595,-0.01283 0.05968,0 0.0625,0 0.0056,0 0.04321,-0.02233 0.1875,0.125 0.144288,0.147334 0.34336,0.447188 0.53125,0.84375 0.06385,0.134761 0.123901,0.309578 0.1875,0.46875 -0.320353,-0.01957 -0.643524,-0.0625 -0.96875,-0.0625 -0.289073,0 -0.558569,0.04702 -0.84375,0.0625 C 71.8761,57.059578 71.936151,56.884761 72,56.75 c 0.18789,-0.396562 0.355712,-0.696416 0.5,-0.84375 0.07214,-0.07367 0.120304,-0.112167 0.15625,-0.125 z m 0,2.40625 c 0.448007,0 0.906196,0.05436 1.34375,0.09375 0.177011,0.592256 0.347655,1.271044 0.5,2.03125 0.475097,2.370753 0.807525,5.463852 0.9375,8.9375 -0.906869,-0.02852 -1.834463,-0.0625 -2.78125,-0.0625 -0.92298,0 -1.802327,0.03537 -2.6875,0.0625 0.138529,-3.473648 0.493653,-6.566747 0.96875,-8.9375 0.154684,-0.771878 0.320019,-1.463985 0.5,-2.0625 0.405568,-0.03377 0.804291,-0.0625 1.21875,-0.0625 z m -2.71875,0.28125 c -0.129732,0.498888 -0.259782,0.987558 -0.375,1.5625 -0.498513,2.487595 -0.838088,5.693299 -0.96875,9.25 -3.21363,0.15162 -6.119596,0.480068 -8.40625,0.9375 -0.682394,0.136509 -1.275579,0.279657 -1.84375,0.4375 0.799068,-6.135482 5.504716,-11.036454 11.59375,-12.1875 z M 75.5,58.5 c 6.043169,1.18408 10.705093,6.052712 11.5,12.15625 -0.569435,-0.155806 -1.200273,-0.302525 -1.875,-0.4375 -2.262525,-0.452605 -5.108535,-0.783809 -8.28125,-0.9375 -0.130662,-3.556701 -0.470237,-6.762405 -0.96875,-9.25 C 75.761959,59.467174 75.626981,58.990925 75.5,58.5 z m -2.84375,12.09375 c 0.959338,0 1.895843,0.03282 2.8125,0.0625 C 75.48165,71.267751 75.5,71.871028 75.5,72.5 c 0,1.228616 -0.01449,2.438313 -0.0625,3.59375 -0.897358,0.0284 -1.811972,0.0625 -2.75,0.0625 -0.927373,0 -1.831062,-0.03473 -2.71875,-0.0625 -0.05109,-1.155437 -0.0625,-2.365134 -0.0625,-3.59375 0,-0.628972 0.01741,-1.232249 0.03125,-1.84375 0.895269,-0.02827 1.783025,-0.0625 2.71875,-0.0625 z M 68.5625,70.6875 c -0.01243,0.60601 -0.03125,1.189946 -0.03125,1.8125 0,1.22431 0.01541,2.407837 0.0625,3.5625 -3.125243,-0.150329 -5.92077,-0.471558 -8.09375,-0.90625 -0.784983,-0.157031 -1.511491,-0.316471 -2.125,-0.5 -0.107878,-0.704096 -0.1875,-1.422089 -0.1875,-2.15625 0,-0.115714 0.02849,-0.228688 0.03125,-0.34375 0.643106,-0.20284 1.389577,-0.390377 2.25,-0.5625 2.166953,-0.433487 4.97905,-0.75541 8.09375,-0.90625 z m 8.3125,0.03125 c 3.075121,0.15271 5.824455,0.446046 7.96875,0.875 0.857478,0.171534 1.630962,0.360416 2.28125,0.5625 0.0027,0.114659 0,0.228443 0,0.34375 0,0.735827 -0.07914,1.450633 -0.1875,2.15625 -0.598568,0.180148 -1.29077,0.34562 -2.0625,0.5 -2.158064,0.431708 -4.932088,0.754666 -8.03125,0.90625 0.04709,-1.154663 0.0625,-2.33819 0.0625,-3.5625 0,-0.611824 -0.01924,-1.185379 -0.03125,-1.78125 z M 57.15625,72.5625 c 0.0023,0.572772 0.06082,1.131112 0.125,1.6875 -0.125327,-0.05123 -0.266577,-0.10497 -0.375,-0.15625 -0.396499,-0.187528 -0.665288,-0.387337 -0.8125,-0.53125 -0.147212,-0.143913 -0.15625,-0.182756 -0.15625,-0.1875 0,-0.0047 -0.02221,-0.07484 0.125,-0.21875 0.147212,-0.143913 0.447251,-0.312472 0.84375,-0.5 0.07123,-0.03369 0.171867,-0.06006 0.25,-0.09375 z m 31.03125,0 c 0.08201,0.03503 0.175941,0.05872 0.25,0.09375 0.396499,0.187528 0.665288,0.356087 0.8125,0.5 0.14725,0.14391 0.15625,0.21405 0.15625,0.21875 0,0.0047 -0.009,0.04359 -0.15625,0.1875 -0.147212,0.143913 -0.416001,0.343722 -0.8125,0.53125 -0.09755,0.04613 -0.233314,0.07889 -0.34375,0.125 0.06214,-0.546289 0.09144,-1.094215 0.09375,-1.65625 z m -29.5,3.625 c 0.479308,0.123125 0.983064,0.234089 1.53125,0.34375 2.301781,0.460458 5.229421,0.787224 8.46875,0.9375 0.167006,2.84339 0.46081,5.433176 0.875,7.5 0.115218,0.574942 0.245268,1.063612 0.375,1.5625 -5.463677,-1.028179 -9.833074,-5.091831 -11.25,-10.34375 z m 27.96875,0 C 85.247546,81.408945 80.919274,85.442932 75.5,86.5 c 0.126981,-0.490925 0.261959,-0.967174 0.375,-1.53125 0.41419,-2.066824 0.707994,-4.65661 0.875,-7.5 3.204493,-0.15162 6.088346,-0.480068 8.375,-0.9375 0.548186,-0.109661 1.051942,-0.220625 1.53125,-0.34375 z M 70.0625,77.53125 c 0.865391,0.02589 1.723666,0.03125 2.625,0.03125 0.912062,0 1.782843,-0.0048 2.65625,-0.03125 -0.165173,2.736408 -0.453252,5.207651 -0.84375,7.15625 -0.152345,0.760206 -0.322989,1.438994 -0.5,2.03125 -0.437447,0.03919 -0.895856,0.0625 -1.34375,0.0625 -0.414943,0 -0.812719,-0.02881 -1.21875,-0.0625 -0.177011,-0.592256 -0.347655,-1.271044 -0.5,-2.03125 -0.390498,-1.948599 -0.700644,-4.419842 -0.875,-7.15625 z m 1.75,10.28125 c 0.284911,0.01545 0.554954,0.03125 0.84375,0.03125 0.325029,0 0.648588,-0.01171 0.96875,-0.03125 -0.05999,0.148763 -0.127309,0.31046 -0.1875,0.4375 -0.18789,0.396562 -0.386962,0.696416 -0.53125,0.84375 -0.144288,0.147334 -0.181857,0.125 -0.1875,0.125 -0.0056,0 -0.07446,0.02233 -0.21875,-0.125 C 72.355712,88.946416 72.18789,88.646562 72,88.25 71.939809,88.12296 71.872486,87.961263 71.8125,87.8125 z",
  svgCompassRotationMarker =
    "M 72.46875,22.03125 C 59.505873,22.050338 46.521615,27.004287 36.6875,36.875 L 47.84375,47.96875 C 61.521556,34.240041 83.442603,34.227389 97.125,47.90625 l 11.125,-11.125 C 98.401629,26.935424 85.431627,22.012162 72.46875,22.03125 z",
  Cesium$9 = window.Cesium,
  defined$5 = Cesium$9.defined,
  getTimestamp$1 = Cesium$9.getTimestamp,
  EventHelper$1 = Cesium$9.EventHelper,
  Transforms = Cesium$9.Transforms,
  SceneMode$2 = Cesium$9.SceneMode,
  Cartesian2$1 = Cesium$9.Cartesian2,
  Cartesian3$2 = Cesium$9.Cartesian3,
  Matrix4 = Cesium$9.Matrix4,
  BoundingSphere = Cesium$9.BoundingSphere,
  HeadingPitchRange = Cesium$9.HeadingPitchRange,
  knockout$5 = Cesium$9.knockout,
  cesiumMath = Cesium$9.Math,
  Knockout$4 = knockout$5,
  NavigationViewModel = function NavigationViewModel(options) {
    (this.terria = options.terria),
      (this.eventHelper = new EventHelper$1()),
      (this.enableZoomControls =
        !defined$5(options.enableZoomControls) || options.enableZoomControls),
      (this.enableCompass =
        !defined$5(options.enableCompass) || options.enableCompass),
      (this.navigationLocked = !1),
      (this.controls = options.controls),
      defined$5(this.controls) ||
        (this.controls = [
          new ZoomNavigationControl(this.terria, !0),
          new ResetViewNavigationControl(this.terria),
          new ZoomNavigationControl(this.terria, !1),
        ]),
      (this.svgCompassOuterRing = svgCompassOuterRing),
      (this.svgCompassGyro = svgCompassGyro),
      (this.svgCompassRotationMarker = svgCompassRotationMarker),
      (this.showCompass = defined$5(this.terria) && this.enableCompass),
      (this.heading = this.showCompass ? this.terria.scene.camera.heading : 0),
      (this.isOrbiting = !1),
      (this.orbitCursorAngle = 0),
      (this.orbitCursorOpacity = 0),
      (this.orbitLastTimestamp = 0),
      (this.orbitFrame = void 0),
      (this.orbitIsLook = !1),
      (this.orbitMouseMoveFunction = void 0),
      (this.orbitMouseUpFunction = void 0),
      (this.isRotating = !1),
      (this.rotateInitialCursorAngle = void 0),
      (this.rotateFrame = void 0),
      (this.rotateIsLook = !1),
      (this.rotateMouseMoveFunction = void 0),
      (this.rotateMouseUpFunction = void 0),
      (this._unsubcribeFromPostRender = void 0),
      Knockout$4.track(this, [
        "controls",
        "showCompass",
        "heading",
        "isOrbiting",
        "orbitCursorAngle",
        "isRotating",
      ]);
    var that = this;
    function widgetChange() {
      defined$5(that.terria)
        ? (that._unsubcribeFromPostRender &&
            (that._unsubcribeFromPostRender(),
            (that._unsubcribeFromPostRender = void 0)),
          (that.showCompass = that.enableCompass),
          (that._unsubcribeFromPostRender =
            that.terria.scene.postRender.addEventListener(function () {
              that.heading = that.terria.scene.camera.heading;
            })))
        : (that._unsubcribeFromPostRender &&
            (that._unsubcribeFromPostRender(),
            (that._unsubcribeFromPostRender = void 0)),
          (that.showCompass = !1));
    }
    (NavigationViewModel.prototype.setNavigationLocked = function (locked) {
      (this.navigationLocked = locked),
        this.controls &&
          1 < this.controls.length &&
          this.controls[1].setNavigationLocked(this.navigationLocked);
    }),
      this.eventHelper.add(this.terria.afterWidgetChanged, widgetChange, this),
      widgetChange();
  },
  vectorScratch =
    ((NavigationViewModel.prototype.destroy = function () {
      this.eventHelper.removeAll();
    }),
    (NavigationViewModel.prototype.show = function (container) {
      var compassDisplay = null == this.enableCompass || this.enableCompass,
        enableZoomControlsDisplay =
          null == this.enableZoomControls || this.enableZoomControls;
      loadView(
        '<div class="compass" id="vis3d-compass" title="" style="display:' +
          (compassDisplay ? "block" : "none") +
          '" data-bind="visible: showCompass, event: { mousedown: handleMouseDown, dblclick: handleDoubleClick }"><div class="compass-outer-ring-background"></div> <div class="compass-rotation-marker" data-bind="visible: isOrbiting, style: { transform: \'rotate(-\' + orbitCursorAngle + \'rad)\', \'-webkit-transform\': \'rotate(-\' + orbitCursorAngle + \'rad)\', opacity: orbitCursorOpacity }, cesiumSvgPath: { path: svgCompassRotationMarker, width: 145, height: 145 }"></div> <div class="compass-outer-ring" title="" data-bind="style: { transform: \'rotate(-\' + heading + \'rad)\', \'-webkit-transform\': \'rotate(-\' + heading + \'rad)\' }, cesiumSvgPath: { path: svgCompassOuterRing, width: 145, height: 145 }"></div> <div class="compass-gyro-background"></div> <div class="compass-gyro" data-bind="cesiumSvgPath: { path: svgCompassGyro, width: 145, height: 145 }, css: { \'compass-gyro-active\': isOrbiting }"></div></div><div class="navigation-controls" id="vis3d-navigation-controls" style="display:' +
          (enableZoomControlsDisplay ? "block" : "none") +
          "\">\x3c!-- ko foreach: controls --\x3e<div data-bind=\"click: activate, attr: { title: $data.name }, css: $root.isLastControl($data) ? 'navigation-control-last' : 'navigation-control' \">   \x3c!-- ko if: $data.hasText --\x3e   <div data-bind=\"text: $data.text, css: $data.isActive ?  'navigation-control-icon-active ' + $data.cssClass : $data.cssClass\"></div>   \x3c!-- /ko --\x3e  \x3c!-- ko ifnot: $data.hasText --\x3e  <div data-bind=\"cesiumSvgPath: { path: $data.svgIcon, width: $data.svgWidth, height: $data.svgHeight }, css: $data.isActive ?  'navigation-control-icon-active ' + $data.cssClass : $data.cssClass\"></div>  \x3c!-- /ko --\x3e </div> \x3c!-- /ko --\x3e</div>",
        container,
        this
      );
    }),
    (NavigationViewModel.prototype.setStyle = function (style) {
      if (style && !(Object.keys(style).length < 1)) {
        var ele = document.getElementById("vis3d-compass"),
          ele2 = document.getElementById("vis3d-navigation-controls");
        if (ele)
          for (var i in style)
            (ele.style[i] = style[i]),
              (ele2.style[i] = style[i]),
              "top" == i && (ele2.style[i] = parseFloat(style[i]) + 100 + "px"),
              "bottom" == i &&
                (ele.style[i] = parseFloat(style[i]) + 82 + "px"),
              "left" == i &&
                (ele2.style.left = parseFloat(ele.style.left) + 30 + "px"),
              "right" == i &&
                (ele2.style.right = parseFloat(ele.style.right) - 30 + "px");
      }
    }),
    (NavigationViewModel.prototype.add = function (control) {
      this.controls.push(control);
    }),
    (NavigationViewModel.prototype.remove = function (control) {
      this.controls.remove(control);
    }),
    (NavigationViewModel.prototype.isLastControl = function (control) {
      return control === this.controls[this.controls.length - 1];
    }),
    new Cartesian2$1()),
  oldTransformScratch =
    ((NavigationViewModel.prototype.handleMouseDown = function (viewModel, e) {
      if (this.terria.scene.mode === SceneMode$2.MORPHING) return !0;
      if (viewModel.navigationLocked) return !0;
      var viewModel = e.currentTarget,
        compassRectangle = e.currentTarget.getBoundingClientRect(),
        maxDistance = compassRectangle.width / 2,
        center = new Cartesian2$1(
          (compassRectangle.right - compassRectangle.left) / 2,
          (compassRectangle.bottom - compassRectangle.top) / 2
        ),
        e = new Cartesian2$1(
          e.clientX - compassRectangle.left,
          e.clientY - compassRectangle.top
        ),
        compassRectangle = Cartesian2$1.subtract(e, center, vectorScratch),
        e = Cartesian2$1.magnitude(compassRectangle) / maxDistance;
      if (e < 50 / 145) orbit(this, viewModel, compassRectangle);
      else {
        if (!(e < 1)) return !0;
        rotate(this, viewModel, compassRectangle);
      }
    }),
    new Matrix4()),
  newTransformScratch = new Matrix4(),
  centerScratch = new Cartesian3$2();
function orbit(viewModel, compassElement, cursorVector) {
  var scene = viewModel.terria.scene,
    sscc = scene.screenSpaceCameraController;
  if (scene.mode !== SceneMode$2.MORPHING && sscc.enableInputs) {
    if (viewModel.navigationLocked) return !0;
    switch (scene.mode) {
      case SceneMode$2.COLUMBUS_VIEW:
        if (sscc.enableLook) break;
        if (sscc.enableTranslate && sscc.enableTilt) break;
        return;
      case SceneMode$2.SCENE3D:
        if (sscc.enableLook) break;
        if (sscc.enableTilt && sscc.enableRotate) break;
        return;
      case SceneMode$2.SCENE2D:
        if (sscc.enableTranslate) break;
        return;
    }
    document.removeEventListener(
      "mousemove",
      viewModel.orbitMouseMoveFunction,
      !1
    ),
      document.removeEventListener(
        "mouseup",
        viewModel.orbitMouseUpFunction,
        !1
      ),
      defined$5(viewModel.orbitTickFunction) &&
        viewModel.terria.clock.onTick.removeEventListener(
          viewModel.orbitTickFunction
        ),
      (viewModel.orbitMouseMoveFunction = void 0),
      (viewModel.orbitMouseUpFunction = void 0),
      (viewModel.orbitTickFunction = void 0),
      (viewModel.isOrbiting = !0),
      (viewModel.orbitLastTimestamp = getTimestamp$1());
    var center,
      camera = scene.camera;
    defined$5(viewModel.terria.trackedEntity)
      ? ((viewModel.orbitFrame = void 0), (viewModel.orbitIsLook = !1))
      : ((center = Utils.getCameraFocus(viewModel.terria, !0, centerScratch)),
        defined$5(center)
          ? ((viewModel.orbitFrame = Transforms.eastNorthUpToFixedFrame(
              center,
              scene.globe.ellipsoid,
              newTransformScratch
            )),
            (viewModel.orbitIsLook = !1))
          : ((viewModel.orbitFrame = Transforms.eastNorthUpToFixedFrame(
              camera.positionWC,
              scene.globe.ellipsoid,
              newTransformScratch
            )),
            (viewModel.orbitIsLook = !0))),
      (viewModel.orbitTickFunction = function (e) {
        var oldTransform,
          timestamp = getTimestamp$1(),
          distance =
            (timestamp - viewModel.orbitLastTimestamp) *
            ((2.5 * (viewModel.orbitCursorOpacity - 0.5)) / 1e3),
          angle = viewModel.orbitCursorAngle + cesiumMath.PI_OVER_TWO,
          x = Math.cos(angle) * distance,
          angle = Math.sin(angle) * distance;
        if (viewModel.navigationLocked) return !0;
        defined$5(viewModel.orbitFrame) &&
          ((oldTransform = Matrix4.clone(
            camera.transform,
            oldTransformScratch
          )),
          camera.lookAtTransform(viewModel.orbitFrame)),
          scene.mode === SceneMode$2.SCENE2D
            ? camera.move(
                new Cartesian3$2(x, angle, 0),
                (Math.max(scene.canvas.clientWidth, scene.canvas.clientHeight) /
                  100) *
                  camera.positionCartographic.height *
                  distance
              )
            : viewModel.orbitIsLook
            ? (camera.look(Cartesian3$2.UNIT_Z, -x),
              camera.look(camera.right, -angle))
            : (camera.rotateLeft(x), camera.rotateUp(angle)),
          defined$5(viewModel.orbitFrame) &&
            camera.lookAtTransform(oldTransform),
          (viewModel.orbitLastTimestamp = timestamp);
      }),
      (viewModel.orbitMouseMoveFunction = function (e) {
        var compassRectangle = compassElement.getBoundingClientRect(),
          center = new Cartesian2$1(
            (compassRectangle.right - compassRectangle.left) / 2,
            (compassRectangle.bottom - compassRectangle.top) / 2
          ),
          e = new Cartesian2$1(
            e.clientX - compassRectangle.left,
            e.clientY - compassRectangle.top
          );
        updateAngleAndOpacity(
          Cartesian2$1.subtract(e, center, vectorScratch),
          compassRectangle.width
        );
      }),
      (viewModel.orbitMouseUpFunction = function (e) {
        (viewModel.isOrbiting = !1),
          document.removeEventListener(
            "mousemove",
            viewModel.orbitMouseMoveFunction,
            !1
          ),
          document.removeEventListener(
            "mouseup",
            viewModel.orbitMouseUpFunction,
            !1
          ),
          defined$5(viewModel.orbitTickFunction) &&
            viewModel.terria.clock.onTick.removeEventListener(
              viewModel.orbitTickFunction
            ),
          (viewModel.orbitMouseMoveFunction = void 0),
          (viewModel.orbitMouseUpFunction = void 0),
          (viewModel.orbitTickFunction = void 0);
      }),
      document.addEventListener(
        "mousemove",
        viewModel.orbitMouseMoveFunction,
        !1
      ),
      document.addEventListener("mouseup", viewModel.orbitMouseUpFunction, !1),
      viewModel.terria.clock.onTick.addEventListener(
        viewModel.orbitTickFunction
      ),
      updateAngleAndOpacity(
        cursorVector,
        compassElement.getBoundingClientRect().width
      );
  }
  function updateAngleAndOpacity(vector, compassWidth) {
    var angle = Math.atan2(-vector.y, vector.x),
      angle =
        ((viewModel.orbitCursorAngle = cesiumMath.zeroToTwoPi(
          angle - cesiumMath.PI_OVER_TWO
        )),
        Cartesian2$1.magnitude(vector)),
      vector = Math.min(angle / (compassWidth / 2), 1);
    viewModel.orbitCursorOpacity = 0.5 * vector * vector + 0.5;
  }
}
function rotate(viewModel, compassElement, cursorVector) {
  var oldTransform,
    scene = viewModel.terria.scene,
    camera = scene.camera,
    sscc = scene.screenSpaceCameraController;
  if (
    scene.mode !== SceneMode$2.MORPHING &&
    scene.mode !== SceneMode$2.SCENE2D &&
    sscc.enableInputs
  ) {
    if (viewModel.navigationLocked) return !0;
    (sscc.enableLook ||
      (scene.mode !== SceneMode$2.COLUMBUS_VIEW &&
        (scene.mode !== SceneMode$2.SCENE3D || sscc.enableRotate))) &&
      (document.removeEventListener(
        "mousemove",
        viewModel.rotateMouseMoveFunction,
        !1
      ),
      document.removeEventListener(
        "mouseup",
        viewModel.rotateMouseUpFunction,
        !1
      ),
      (viewModel.rotateMouseMoveFunction = void 0),
      (viewModel.rotateMouseUpFunction = void 0),
      (viewModel.isRotating = !0),
      (viewModel.rotateInitialCursorAngle = Math.atan2(
        -cursorVector.y,
        cursorVector.x
      )),
      defined$5(viewModel.terria.trackedEntity)
        ? ((viewModel.rotateFrame = void 0), (viewModel.rotateIsLook = !1))
        : ((cursorVector = Utils.getCameraFocus(
            viewModel.terria,
            !0,
            centerScratch
          )),
          defined$5(cursorVector) &&
          (scene.mode !== SceneMode$2.COLUMBUS_VIEW ||
            sscc.enableLook ||
            sscc.enableTranslate)
            ? ((viewModel.rotateFrame = Transforms.eastNorthUpToFixedFrame(
                cursorVector,
                scene.globe.ellipsoid,
                newTransformScratch
              )),
              (viewModel.rotateIsLook = !1))
            : ((viewModel.rotateFrame = Transforms.eastNorthUpToFixedFrame(
                camera.positionWC,
                scene.globe.ellipsoid,
                newTransformScratch
              )),
              (viewModel.rotateIsLook = !0))),
      defined$5(viewModel.rotateFrame) &&
        ((oldTransform = Matrix4.clone(camera.transform, oldTransformScratch)),
        camera.lookAtTransform(viewModel.rotateFrame)),
      (viewModel.rotateInitialCameraAngle = -camera.heading),
      defined$5(viewModel.rotateFrame) && camera.lookAtTransform(oldTransform),
      (viewModel.rotateMouseMoveFunction = function (e) {
        var oldTransform,
          compassRectangle = compassElement.getBoundingClientRect(),
          center = new Cartesian2$1(
            (compassRectangle.right - compassRectangle.left) / 2,
            (compassRectangle.bottom - compassRectangle.top) / 2
          ),
          e = new Cartesian2$1(
            e.clientX - compassRectangle.left,
            e.clientY - compassRectangle.top
          ),
          compassRectangle = Cartesian2$1.subtract(e, center, vectorScratch),
          e =
            Math.atan2(-compassRectangle.y, compassRectangle.x) -
            viewModel.rotateInitialCursorAngle,
          center = cesiumMath.zeroToTwoPi(
            viewModel.rotateInitialCameraAngle - e
          ),
          compassRectangle = viewModel.terria.scene.camera,
          e =
            (defined$5(viewModel.rotateFrame) &&
              ((oldTransform = Matrix4.clone(
                compassRectangle.transform,
                oldTransformScratch
              )),
              compassRectangle.lookAtTransform(viewModel.rotateFrame)),
            -compassRectangle.heading);
        compassRectangle.rotateRight(center - e),
          defined$5(viewModel.rotateFrame) &&
            compassRectangle.lookAtTransform(oldTransform);
      }),
      (viewModel.rotateMouseUpFunction = function (e) {
        (viewModel.isRotating = !1),
          document.removeEventListener(
            "mousemove",
            viewModel.rotateMouseMoveFunction,
            !1
          ),
          document.removeEventListener(
            "mouseup",
            viewModel.rotateMouseUpFunction,
            !1
          ),
          (viewModel.rotateMouseMoveFunction = void 0),
          (viewModel.rotateMouseUpFunction = void 0);
      }),
      document.addEventListener(
        "mousemove",
        viewModel.rotateMouseMoveFunction,
        !1
      ),
      document.addEventListener(
        "mouseup",
        viewModel.rotateMouseUpFunction,
        !1
      ));
  }
}
(NavigationViewModel.prototype.handleDoubleClick = function (viewModel, e) {
  var scene = viewModel.terria.scene,
    camera = scene.camera,
    sscc = scene.screenSpaceCameraController;
  if (scene.mode === SceneMode$2.MORPHING || !sscc.enableInputs) return !0;
  if (viewModel.navigationLocked) return !0;
  if (scene.mode !== SceneMode$2.COLUMBUS_VIEW || sscc.enableTranslate) {
    if (
      scene.mode === SceneMode$2.SCENE3D ||
      scene.mode === SceneMode$2.COLUMBUS_VIEW
    ) {
      if (!sscc.enableLook) return;
      if (scene.mode === SceneMode$2.SCENE3D && !sscc.enableRotate) return;
    }
    var focusBoundingSphere,
      sscc = Utils.getCameraFocus(viewModel.terria, !0, centerScratch);
    defined$5(sscc)
      ? ((viewModel = scene.globe.ellipsoid.cartographicToCartesian(
          camera.positionCartographic,
          new Cartesian3$2()
        )),
        (scene = scene.globe.ellipsoid.geodeticSurfaceNormal(sscc)),
        (focusBoundingSphere = new BoundingSphere(sscc, 0)),
        camera.flyToBoundingSphere(focusBoundingSphere, {
          offset: new HeadingPitchRange(
            0,
            cesiumMath.PI_OVER_TWO -
              Cartesian3$2.angleBetween(scene, camera.directionWC),
            Cartesian3$2.distance(viewModel, sscc)
          ),
          duration: 1.5,
        }))
      : this.controls[1].resetView();
  }
}),
  (NavigationViewModel.create = function (options) {
    var result = new NavigationViewModel(options);
    return (
      result.show(options.container), result.setStyle(options.style), result
    );
  });
var Cesium$a = window.Cesium,
  defined$6 = Cesium$a.defined,
  Event = Cesium$a.Event,
  knockout$6 = Cesium$a.knockout,
  DeveloperError$2 = Cesium$a.DeveloperError,
  CesiumEvent = Event,
  CesiumNavigation = function (viewerCesiumWidget, options) {
    initialize.apply(this, arguments), (this._onDestroyListeners = []);
  };
function initialize(viewerCesiumWidget, options) {
  if (!defined$6(viewerCesiumWidget))
    throw new DeveloperError$2("CesiumWidget or Viewer is required.");
  defined$6(viewerCesiumWidget.cesiumWidget) && viewerCesiumWidget.cesiumWidget;
  var container = document.createElement("div");
  (container.className = "cesium-widget-cesiumNavigationContainer"),
    (container.style.position = "relative"),
    (container.style.bottom = "30px"),
    (container.style.zIndex = "99"),
    document
      .getElementById(viewerCesiumWidget._container.id)
      .appendChild(container),
    (this.container = container),
    (this.terria = viewerCesiumWidget),
    (this.terria.options = defined$6(options) ? options : {}),
    (this.terria.afterWidgetChanged = new CesiumEvent()),
    (this.terria.beforeWidgetChanged = new CesiumEvent()),
    (this.distanceLegendDiv = document.createElement("div")),
    container.appendChild(this.distanceLegendDiv),
    this.distanceLegendDiv.setAttribute("id", "distanceLegendDiv");
  viewerCesiumWidget =
    "string" ==
    typeof (viewerCesiumWidget =
      (options.distanceLegend && options.distanceLegend.style) || "leftBottom")
      ? getDistanceStyleByAttr(viewerCesiumWidget)
      : viewerCesiumWidget;
  (this.distanceLegendViewModel = DistanceLegendViewModel.create({
    container: this.distanceLegendDiv,
    style: viewerCesiumWidget,
    terria: this.terria,
    enableDistanceLegend:
      null == this.terria.options.enableDistanceLegend ||
      this.terria.options.enableDistanceLegend,
  })),
    (this.navigationDiv = document.createElement("div")),
    this.navigationDiv.setAttribute("id", "navigationDiv"),
    container.appendChild(this.navigationDiv);
  viewerCesiumWidget =
    "string" ==
    typeof (viewerCesiumWidget =
      (options.compass && options.compass.style) || "leftBottom")
      ? getCompassStyleByAttr(viewerCesiumWidget)
      : viewerCesiumWidget;
  (this.navigationViewModel = NavigationViewModel.create({
    container: this.navigationDiv,
    terria: this.terria,
    style: viewerCesiumWidget,
    enableZoomControls:
      null == this.terria.options.enableZoomControls ||
      this.terria.options.enableZoomControls,
    enableCompass:
      null == this.terria.options.enableCompass ||
      this.terria.options.enableCompass,
  })),
    registerKnockoutBindings();
}
function getDistanceStyleByAttr(type) {
  var defaultStyle = {};
  return (
    ((defaultStyle =
      "leftBottom" == (type = type || "leftBottom")
        ? { left: "0px", bottom: "4px" }
        : "leftTop" == type
        ? { left: "0px", top: "20px" }
        : "rightBottom" == type
        ? { right: "20px", bottom: "4px" }
        : "rightTop" == type
        ? { right: "20px", top: "20px" }
        : type).zIndex = 99999),
    defaultStyle
  );
}
function getCompassStyleByAttr(type) {
  var defaultStyle = {};
  return (
    ((defaultStyle =
      "leftBottom" == (type = type || "rightTop")
        ? { left: "20px", bottom: "60px" }
        : "leftTop" == type
        ? { left: "20px", top: "20px" }
        : "rightBottom" == type
        ? { right: "20px", bottom: "60px" }
        : "rightTop" == type
        ? { right: "20px", top: "20px" }
        : type).zIndex = 99999),
    defaultStyle
  );
}
(CesiumNavigation.prototype.distanceLegendViewModel = void 0),
  (CesiumNavigation.prototype.navigationViewModel = void 0),
  (CesiumNavigation.prototype.navigationDiv = void 0),
  (CesiumNavigation.prototype.distanceLegendDiv = void 0),
  (CesiumNavigation.prototype.terria = void 0),
  (CesiumNavigation.prototype.container = void 0),
  (CesiumNavigation.prototype._onDestroyListeners = void 0),
  (CesiumNavigation.prototype._navigationLocked = !1),
  (CesiumNavigation.prototype.setNavigationLocked = function (locked) {
    (this._navigationLocked = locked),
      this.navigationViewModel.setNavigationLocked(this._navigationLocked);
  }),
  (CesiumNavigation.prototype.getNavigationLocked = function () {
    return this._navigationLocked;
  }),
  (CesiumNavigation.prototype.setVisible = function (visible) {
    var dom_legend = document.querySelector(".distance-legend"),
      dom_compass = document.querySelector(".compass"),
      dom_controls = document.querySelector(".navigation-controls");
    (dom_legend.style.display = visible ? "block" : "none"),
      (dom_compass.style.display = visible ? "block" : "none"),
      (dom_controls.style.display = visible ? "block" : "none");
  }),
  (CesiumNavigation.prototype.destroy = function () {
    defined$6(this.navigationViewModel) && this.navigationViewModel.destroy(),
      defined$6(this.distanceLegendViewModel) &&
        this.distanceLegendViewModel.destroy(),
      defined$6(this.navigationDiv) &&
        this.navigationDiv.parentNode.removeChild(this.navigationDiv),
      delete this.navigationDiv,
      defined$6(this.distanceLegendDiv) &&
        this.distanceLegendDiv.parentNode.removeChild(this.distanceLegendDiv),
      delete this.distanceLegendDiv,
      defined$6(this.container) &&
        this.container.parentNode.removeChild(this.container),
      delete this.container;
    for (var i = 0; i < this._onDestroyListeners.length; i++)
      this._onDestroyListeners[i]();
  }),
  (CesiumNavigation.prototype.addOnDestroyListener = function (callback) {
    "function" == typeof callback && this._onDestroyListeners.push(callback);
  });
var ZoomTool = (function () {
    function ZoomTool(viewer, opt) {
      _classCallCheck(this, ZoomTool),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.step = this.opt.step || 0.5),
        (this.forwardAmount = null),
        (this.backwardAmount = null),
        (this.position = null);
    }
    return (
      _createClass(ZoomTool, [
        {
          key: "forward",
          value: function () {
            var amount;
            this.backwardAmount
              ? ((amount = this.backwardAmount), (this.backwardAmount = null))
              : ((amount = this.computeLength() || 0), (amount *= this.step)),
              this.viewer.camera.moveForward(amount),
              (this.forwardAmount = amount);
          },
        },
        {
          key: "backward",
          value: function () {
            var amount;
            this.forwardAmount
              ? ((amount = this.forwardAmount), (this.forwardAmount = null))
              : ((amount = this.computeLength() || 0), (amount *= this.step)),
              this.viewer.camera.moveBackward(amount),
              (this.backwardAmount = amount);
          },
        },
        {
          key: "computeLength",
          value: function () {
            this.position = this.viewer.camera.position;
            var dir = this.viewer.camera.direction,
              lnglat = Cesium.Cartographic.fromCartesian(this.position),
              height = lnglat.height,
              ray = new Cesium.Ray(this.position.clone(), dir.clone()),
              ray = this.viewer.scene.globe.pick(ray, this.viewer.scene);
            if (ray)
              return (
                (ray = Cesium.Cartographic.fromCartesian(ray)),
                (height = lnglat.height - ray.height),
                (dir = Cesium.Cartesian3.normalize(
                  dir,
                  new Cesium.Cartesian3()
                )),
                (lnglat = new Cesium.Cartesian3(0, 0, -1)),
                (ray = Cesium.Cartesian3.dot(dir, lnglat)),
                (dir = Math.asin(ray)),
                height / Math.cos(dir)
              );
          },
        },
      ]),
      ZoomTool
    );
  })(),
  RightTool = (function () {
    function RightTool(viewer, opt) {
      _classCallCheck(this, RightTool), (opt = opt || {});
      (this.opt = Object.assign(
        { lnglat: !0, cameraView: !0, depth: !0 },
        opt
      )),
        viewer
          ? ((this.viewer = viewer),
            (opt = this.viewer.container.id),
            (this.mapContainer = document.getElementById(opt)),
            (this.rightClickHandler = new Cesium.ScreenSpaceEventHandler(
              this.viewer.scene.canvas
            )),
            (this.randomId =
              new Date().getTime() + "" + Math.ceil(1e4 * Math.random())),
            (viewer = this.createElement("div", {
              class: "vis3d-right-tool",
              id: "vis3d-right-tool-".concat(this.randomId),
              html: "<ul></ul>",
            })),
            this.mapContainer.appendChild(viewer),
            (opt = document.getElementById(
              "vis3d-right-tool-".concat(this.randomId)
            )),
            (this.toolMenu = opt.querySelector("ul")),
            document.addEventListener("click", function () {
              var tool = document.getElementsByClassName("vis3d-right-tool");
              tool[0] && (tool[0].style.display = "none");
            }),
            document
              .getElementById("vis3d-right-tool-".concat(this.randomId))
              .addEventListener("click", function (event) {
                event.stopPropagation();
              }),
            this.opt.lnglat && this.crateLnglatTool(),
            this.opt.cameraView && this.createCameraViewTool(),
            this.opt.depth && this.crateDepthTool(),
            this.bindHandler(),
            (this._clickPX = null),
            (this.scale = this.opt.scale || [1, 1]))
          : console.log("缺少viewer对象！");
    }
    return (
      _createClass(RightTool, [
        {
          key: "createElement",
          value: function (eleType, opt) {
            opt = opt || {};
            eleType = document.createElement(eleType);
            return (
              opt.class && (eleType.className = opt.class),
              opt.id && eleType.setAttribute("id", opt.id),
              (eleType.innerHTML = opt.html),
              eleType
            );
          },
        },
        {
          key: "crateLnglatTool",
          value: function () {
            var that = this,
              dom = this.createElement("li", {
                id: "right-tool-lnglat-".concat(this.randomId),
                class: "right-tool-lnglat",
                html: '<span style="font-weight:bold;">当前坐标</span>',
              });
            this.toolMenu.appendChild(dom),
              document
                .getElementById("right-tool-lnglat-".concat(this.randomId))
                .addEventListener("click", function (evt) {
                  if (that._clickPX) {
                    for (
                      var cartesian,
                        lng,
                        lat,
                        picks = that.viewer.scene.drillPick(that._clickPX),
                        isOn3dtiles = (that.viewer.scene.render(), !1),
                        i = 0;
                      i < picks.length;
                      i++
                    )
                      if (
                        picks[i] &&
                        picks[i].primitive &&
                        picks[i].primitive instanceof Cesium.Cesium3DTileset
                      ) {
                        isOn3dtiles = !0;
                        break;
                      }
                    if (isOn3dtiles)
                      cartesian = that.viewer.scene.pickPosition(that._clickPX);
                    else {
                      var ray = that.viewer.camera.getPickRay(that._clickPX);
                      if (!ray) return null;
                      cartesian = that.viewer.scene.globe.pick(
                        ray,
                        that.viewer.scene
                      );
                    }
                    cartesian &&
                      ((ray = Cesium.Cartographic.fromCartesian(
                        cartesian.clone()
                      )),
                      (lng = Cesium.Math.toDegrees(ray.longitude)),
                      (lat = Cesium.Math.toDegrees(ray.latitude)),
                      (ray = ray.height),
                      (cartesian = "["
                        .concat(Number(cartesian.x), " , ")
                        .concat(Number(cartesian.y), " , ")
                        .concat(Number(cartesian.z), "]")),
                      (lng = "["
                        .concat(Number(lng).toFixed(6), " , ")
                        .concat(Number(lat).toFixed(6), " , ")
                        .concat(Number(ray).toFixed(2), "]")),
                      (lat =
                        "\n                世界坐标：\n                <div>"
                          .concat(
                            cartesian,
                            "</div>\n                经纬度：\n                <div>"
                          )
                          .concat(lng, "</div>\n            ")),
                      that.crerateResultHtml("该点坐标", lat));
                  }
                });
          },
        },
        {
          key: "createCameraViewTool",
          value: function () {
            var that = this,
              dom = this.createElement("li", {
                class: "right-tool-view",
                id: "right-tool-view-".concat(this.randomId),
                html: "<span>相机视角</span>",
              });
            this.toolMenu.appendChild(dom),
              document
                .getElementById("right-tool-view-".concat(this.randomId))
                .addEventListener("click", function () {
                  var camera = that.viewer.camera,
                    position = camera.position,
                    heading = camera.heading,
                    pitch = camera.pitch,
                    camera = camera.roll,
                    position = Cesium.Cartographic.fromCartesian(position),
                    position =
                      '\n                <div>{</div>\n                <ul style="margin-left:10px;">\n                    <li>\n                        <span>\n                            "x" : '
                        .concat(
                          Cesium.Math.toDegrees(position.longitude),
                          ',\n                        </span>\n                    </li>\n                    <li>\n                        <span>\n                            "y" : '
                        )
                        .concat(
                          Cesium.Math.toDegrees(position.latitude),
                          ',\n                        </span>\n                    </li>\n                    <li>\n                        <span>\n                            "z" : '
                        )
                        .concat(
                          position.height,
                          ',\n                        </span>\n                    </li>\n                    <li>\n                        <span>\n                            "heading" : '
                        )
                        .concat(
                          Cesium.Math.toDegrees(heading),
                          ',\n                        </span>\n                    </li>\n                    <li>\n                        <span>\n                            "pitch" : '
                        )
                        .concat(
                          Cesium.Math.toDegrees(pitch),
                          ',\n                        </span>\n                    </li>\n                    <li>\n                        <span>\n                        "roll" : '
                        )
                        .concat(
                          Cesium.Math.toDegrees(camera),
                          "\n                        </span>\n                    </li>\n                </ul>\n                <div>}</div>\n            "
                        );
                  that.crerateResultHtml("当前相机视角", position);
                });
          },
        },
        {
          key: "crateDepthTool",
          value: function () {
            var that = this,
              depthVal = this.viewer.scene.globe.depthTestAgainstTerrain
                ? "深度检测（关）"
                : "深度检测（开）",
              depthVal = this.createElement("li", {
                class: "right-tool-view",
                id: "right-tool-view-".concat(this.randomId),
                html: ' <span class="right-tool-depth" id="right-tool-depth-'
                  .concat(this.randomId, '">\n                        ')
                  .concat(depthVal, "\n                    </span>"),
              }),
              depthDom =
                (this.toolMenu.appendChild(depthVal),
                document.getElementById(
                  "right-tool-depth-".concat(this.randomId)
                ));
            depthDom.addEventListener("click", function (evt, res) {
              var tool = document.getElementsByClassName("vis3d-right-tool");
              tool[0] && (tool[0].style.display = "none"),
                -1 != depthDom.innerText.indexOf("开")
                  ? ((depthDom.innerText = "深度检测（关）"),
                    (that.viewer.scene.globe.depthTestAgainstTerrain = !0))
                  : ((depthDom.innerText = "深度检测（开）"),
                    (that.viewer.scene.globe.depthTestAgainstTerrain = !1));
            });
          },
        },
        {
          key: "refreshDepthVal",
          value: function () {
            var depthVal = this.viewer.scene.globe.depthTestAgainstTerrain
              ? "深度检测（关）"
              : "深度检测（开）";
            document.getElementById(
              "right-tool-depth-".concat(this.randomId)
            ).innerHTML = depthVal;
          },
        },
        {
          key: "bindHandler",
          value: function () {
            var that = this;
            this.rightClickHandler.setInputAction(function (evt) {
              var pick,
                ent,
                dom = document.getElementById(
                  "vis3d-right-tool-".concat(that.randomId)
                );
              util$1.control.isOpenRightTool
                ? ((evt.position.x = evt.position.x / that.scale[0]),
                  (evt.position.y = evt.position.y / that.scale[1]),
                  !(pick = that.viewer.scene.pick(evt.position)) ||
                    !pick.primitive ||
                    pick.primitive instanceof Cesium.Cesium3DTileset ||
                    (ent = pick.primitive),
                  ((ent =
                    pick && pick.id && pick.id instanceof Cesium.Entity
                      ? pick.id
                      : ent) &&
                    ent.objId) ||
                    (that.refreshDepthVal(),
                    (that._clickPX = evt.position),
                    (dom.style.left = Number(evt.position.x + 10) + "px"),
                    (dom.style.top = Number(evt.position.y + 10) + "px"),
                    (dom.style.display = "block")))
                : (dom.style.display = "none");
            }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.rightClickHandler &&
              (this.rightClickHandler.destroy(),
              (this.rightClickHandler = null));
            var dom = document.getElementById(
                "vis3d-right-tool-".concat(this.randomId)
              ),
              dom =
                (dom.parentNode.removeChild(dom),
                document.getElementById(
                  "vis3d-right-content-".concat(this.randomId)
                ));
            dom.parentNode.removeChild(dom);
          },
        },
        {
          key: "crerateResultHtml",
          value: function (title, result) {
            var rightContent = document.getElementById(
                "vis3d-right-content-".concat(this.randomId)
              ),
              rightContent =
                (rightContent &&
                  rightContent.parentNode.removeChild(rightContent),
                document.getElementsByClassName("vis3d-right-tool")),
              rightContent =
                (rightContent[0] && (rightContent[0].style.display = "none"),
                this.createElement("div", {
                  class: "vis3d-right-content",
                  id: "vis3d-right-content-".concat(this.randomId),
                  html: '\n            <span class="right-content-close" id="right-content-close-'
                    .concat(
                      this.randomId,
                      '" alt="" title="点击关闭">x</span>\n            <div class="right-content-result scrollbar">\n                <div class="content-result-title" style="font-weight:bold;">'
                    )
                    .concat(
                      title,
                      '：</div>\n                <div class="content-result-line"></div>\n                <div class="content-result-info">'
                    )
                    .concat(result, "</div>\n            </div>\n            "),
                })),
              title = this.viewer.container.id,
              result =
                (window.document
                  .getElementById(title)
                  .appendChild(rightContent),
                document.getElementById(
                  "right-content-close-".concat(this.randomId)
                )),
              that = this;
            result.addEventListener(
              "click",
              function () {
                var rightContent = document.getElementById(
                  "vis3d-right-content-".concat(that.randomId)
                );
                rightContent &&
                  rightContent.parentNode.removeChild(rightContent);
              },
              this
            );
          },
        },
        {
          key: "extend",
          value: function (opt) {
            var id = opt.id || new Date().getTime(),
              id = opt.id || "right-tool-extend-".concat(id),
              dom = this.createElement("li", {
                id: id,
                class: opt.class || "right-tool-extend",
                html: opt.content,
              });
            this.toolMenu.appendChild(dom),
              document
                .getElementById(id)
                .addEventListener("click", function () {
                  var tool =
                    document.getElementsByClassName("vis3d-right-tool");
                  tool[0] && (tool[0].style.display = "none"),
                    opt.click && opt.click();
                });
          },
        },
      ]),
      RightTool
    );
  })(),
  LnglatTool = (function () {
    function LnglatTool(viewer, opt) {
      _classCallCheck(this, LnglatTool),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.moveHandler = new Cesium.ScreenSpaceEventHandler(
          this.viewer.scene.canvas
        )),
        this.initHtml(),
        this.bindMouseMoveHandler(),
        (this.ellipsoid = this.viewer.scene.globe.ellipsoid),
        (this.scale = this.opt.scale || [1, 1]);
    }
    return (
      _createClass(LnglatTool, [
        {
          key: "bindMouseMoveHandler",
          value: function () {
            var that = this;
            this.moveHandler.setInputAction(function (evt) {
              var lat,
                lng,
                cameraV,
                evt = that.getCatesian3FromPX(evt.endPosition);
              evt &&
                ((evt = that.ellipsoid.cartesianToCartographic(evt)),
                (lat = Cesium.Math.toDegrees(evt.latitude)),
                (lng = Cesium.Math.toDegrees(evt.longitude)),
                (evt = evt.height),
                (cameraV = that.getCameraView()),
                that.setHtml({ lng: lng, lat: lat, height: evt }, cameraV));
            }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.moveHandler &&
              (this.moveHandler.destroy(), (this.moveHandler = null));
            var doms = document.getElementsByClassName(
              "vis3d-lnglatNavigation"
            );
            doms && !doms[0] && doms[0].parentNode.removeChild(doms[0]);
          },
        },
        {
          key: "setVisible",
          value: function (visible) {
            var doms = document.getElementsByClassName(
              "vis3d-lnglatNavigation"
            );
            doms[0] && (doms[0].style.display = visible ? "block" : "none");
          },
        },
        {
          key: "initHtml",
          value: function () {
            var id = this.viewer.container.id,
              id = document.getElementById(id),
              ele = document.createElement("div");
            (ele.className = "vis3d-lnglatNavigation"),
              (ele.innerHTML =
                ' \n                <span style="width:120px;"></span>   \n                <span style="width:120px;"></span>\n                <span style="width:120px;"></span>\n                <span></span>\n                <span></span>\n                <span></span>\n                <span></span>\n        '),
              id.appendChild(ele);
          },
        },
        {
          key: "getCatesian3FromPX",
          value: function (px) {
            if (px) {
              (px.x = px.x / this.scale[0]), (px.y = px.y / this.scale[1]);
              var pick = this.viewer.scene.pick(px),
                cartesian = void 0;
              if (pick && pick.primitive instanceof Cesium.Cesium3DTileset)
                cartesian = this.viewer.scene.pickPosition(px);
              else {
                pick = this.viewer.camera.getPickRay(px);
                if (!pick) return null;
                cartesian = this.viewer.scene.globe.pick(
                  pick,
                  this.viewer.scene
                );
              }
              return cartesian;
            }
          },
        },
        {
          key: "setHtml",
          value: function (latlngOpt, cameraView) {
            var lng = Number(latlngOpt.lng).toFixed(6),
              lat = Number(latlngOpt.lat).toFixed(6),
              latlngOpt = Number(latlngOpt.height).toFixed(2),
              heading = Number(cameraView.heading).toFixed(2),
              pitch = Number(cameraView.pitch).toFixed(2),
              roll = Number(cameraView.roll).toFixed(2),
              cameraView = Number(cameraView.z).toFixed(2),
              eles = document.getElementsByClassName("vis3d-lnglatNavigation");
            !eles ||
              eles.length < 1 ||
              (((eles = eles[0].children)[0].innerHTML = "经度：".concat(lng)),
              (eles[1].innerHTML = "纬度：".concat(lat)),
              (eles[2].innerHTML = "高度：".concat(latlngOpt)),
              (eles[3].innerHTML = "偏转角：".concat(heading)),
              (eles[4].innerHTML = "仰俯角：".concat(pitch)),
              (eles[5].innerHTML = "翻滚角：".concat(roll)),
              (eles[6].innerHTML = "相机高度：".concat(cameraView)));
          },
        },
        {
          key: "getCameraView",
          value: function () {
            var camera = this.viewer.camera,
              position = camera.position,
              heading = camera.heading,
              pitch = camera.pitch,
              camera = camera.roll,
              position = Cesium.Cartographic.fromCartesian(position);
            return {
              x: Cesium.Math.toDegrees(position.longitude),
              y: Cesium.Math.toDegrees(position.latitude),
              z: position.height,
              heading: Cesium.Math.toDegrees(heading),
              pitch: Cesium.Math.toDegrees(pitch),
              roll: Cesium.Math.toDegrees(camera),
            };
          },
        },
      ]),
      LnglatTool
    );
  })(),
  LayerSplit = (function () {
    function LayerSplit(viewer, opt) {
      _classCallCheck(this, LayerSplit),
        (this.viewer = viewer),
        (this.slider = null),
        (this.handler = null),
        (this.moveActive = !1),
        (this.opt = opt || {}),
        (this.layer = this.opt.layer),
        (this.splitDirection =
          null == this.opt.splitDirection ? 1 : this.opt.splitDirection),
        this.layer && (this.layer.splitDirection = this.splitDirection),
        (this.mapContainer = this.viewer.container),
        this.init();
    }
    return (
      _createClass(LayerSplit, [
        {
          key: "init",
          value: function () {
            var that = this;
            (this.slider = window.document.createElement("div")),
              this.slider.setAttribute("id", "layer-split"),
              (this.slider.style.height = "100%"),
              (this.slider.style.width = "5px"),
              (this.slider.style.position = "absolute"),
              (this.slider.style.left = "50%"),
              (this.slider.style.top = "0px"),
              (this.slider.style.background = "rgba(255,255,255,0.5)"),
              this.mapContainer.appendChild(this.slider),
              (this.handler = new window.Cesium.ScreenSpaceEventHandler(
                this.slider
              )),
              (this.viewer.scene.splitPosition = 0.5),
              this.handler.setInputAction(function () {
                that.moveActive = !0;
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.handler.setInputAction(function () {
                that.moveActive = !0;
              }, Cesium.ScreenSpaceEventType.PINCH_START),
              this.handler.setInputAction(function (movement) {
                that.move(movement);
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE),
              this.handler.setInputAction(function (movement) {
                that.move(movement);
              }, Cesium.ScreenSpaceEventType.PINCH_MOVE),
              this.handler.setInputAction(function () {
                that.moveActive = !1;
              }, Cesium.ScreenSpaceEventType.LEFT_UP),
              this.handler.setInputAction(function () {
                that.moveActive = !1;
              }, Cesium.ScreenSpaceEventType.PINCH_END);
          },
        },
        {
          key: "move",
          value: function (movement) {
            this.moveActive &&
              ((movement = movement.endPosition.x),
              (movement =
                (this.slider.offsetLeft + movement) /
                this.slider.parentElement.offsetWidth),
              (this.slider.style.left = 100 * movement + "%"),
              (this.viewer.scene.splitPosition = movement));
          },
        },
        {
          key: "destroy",
          value: function () {
            this.slider &&
              (this.slider.parentNode.removeChild(this.slider),
              (this.slider = null)),
              this.handler && (this.handler.destroy(), (this.handler = null)),
              (this.layer.splitDirection = window.Cesium.SplitDirection.NONE);
          },
        },
        {
          key: "setLayer",
          value: function (layer) {
            layer &&
              ((this.layer.splitDirection = window.Cesium.SplitDirection.NONE),
              (this.layer = layer),
              (this.layer.splitDirection = this.splitDirection));
          },
        },
      ]),
      LayerSplit
    );
  })(),
  Cluster = (function () {
    function Cluster(viewer, opt) {
      _classCallCheck(this, Cluster),
        (this.viewer = viewer),
        (this.opt = opt || {});
      viewer = [
        { number: 10, color: "rgba(0,255,0,0.3)" },
        { number: 50, color: "rgba(255,255,0,0.3)" },
        { number: Number.MAX_VALUE, color: "rgba(255,0,0,0.3)" },
      ];
      (this.conditions = this.opt.conditions || viewer),
        (this.conditions = this.conditions.sort(function (a, b) {
          return a.number - b.number;
        })),
        (this.opt = Object.assign(
          { enabled: !0, pixelRange: 60, minimumClusterSize: 3 },
          this.opt
        )),
        (this.clusterDataSource = new Cesium.CustomDataSource(
          "clusterDataSource"
        )),
        (this.clusterDataSource.clustering.enabled = this.opt.enabled),
        (this.clusterDataSource.clustering.pixelRange = this.opt.pixelRange),
        (this.clusterDataSource.clustering.minimumClusterSize =
          this.opt.minimumClusterSize),
        this.viewer.dataSources.add(this.clusterDataSource),
        this.bindCluster();
    }
    return (
      _createClass(Cluster, [
        {
          key: "add",
          value: function (ent) {
            ent && this.clusterDataSource.entities.add(ent);
          },
        },
        {
          key: "remove",
          value: function (ent) {
            ent && this.clusterDataSource.entities.remove(ent);
          },
        },
        {
          key: "clear",
          value: function () {
            this.clusterDataSource.entities.removeAll();
          },
        },
        {
          key: "destroy",
          value: function () {
            this.clusterDataSource.entities.removeAll(),
              this.viewer.dataSources.remove(this.clusterDataSource);
          },
        },
        {
          key: "open",
          value: function () {
            this.clusterDataSource.enableCluster = !0;
          },
        },
        {
          key: "close",
          value: function () {
            this.clusterDataSource.enableCluster = !1;
          },
        },
        {
          key: "bindCluster",
          value: function () {
            var that = this;
            this.clusterDataSource.clustering.clusterEvent.addEventListener(
              function (clusteredEntities, cluster) {
                clusteredEntities = clusteredEntities.length;
                (cluster.label.show = !1),
                  (cluster.billboard.show = !0),
                  (cluster.billboard.id = cluster.label.id),
                  (cluster.billboard.verticalOrigin =
                    Cesium.VerticalOrigin.BOTTOM),
                  (cluster.billboard.image =
                    that.getClusterImg(clusteredEntities));
              },
              window
            );
          },
        },
        {
          key: "getClusterImg",
          value: function (length, fun) {
            var canvas = document.createElement("canvas"),
              ctx =
                ((canvas.width = 64),
                (canvas.height = 64),
                canvas.getContext("2d")),
              color =
                (ctx.beginPath(),
                ctx.arc(32, 32, 20, 0, 2 * Math.PI, !0),
                ctx.closePath(),
                this.getColorByLength(length) || "rgba(0,255,0,0.3)"),
              color =
                ((ctx.fillStyle = color),
                ctx.fill(),
                (ctx.textAlign = "center"),
                (ctx.textBaseline = "middle"),
                (ctx.font = "16px Arial"),
                (ctx.fillStyle = "#ffffff"),
                length + "");
            return (
              ctx.fillText(color, canvas.width / 2, canvas.height / 2 + 2),
              canvas.toDataURL("image/png")
            );
          },
        },
        {
          key: "getColorByLength",
          value: function (number) {
            return this.conditions.find(function (cd) {
              return cd.number > number;
            }).color;
          },
        },
      ]),
      Cluster
    );
  })(),
  SkyboxGround = (function () {
    function SkyboxGround(options) {
      _classCallCheck(this, SkyboxGround),
        (this.sources = options.sources),
        (this._sources = void 0),
        (this.show = Cesium.defaultValue(options.show, !0)),
        (this._command = new Cesium.DrawCommand({
          modelMatrix: Cesium.Matrix4.clone(Cesium.Matrix4.IDENTITY),
          owner: this,
        })),
        (this._cubeMap = void 0),
        (this._attributeLocations = void 0),
        (this._useHdr = void 0),
        (this.SkyBoxFS =
          "\n            uniform samplerCube u_cubeMap;\n            in vec3 v_texCoord;\n            void main()\n            {\n                vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\n                out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n            }\n            "),
        (this.SkyBoxVS =
          "\n            in vec3 position;\n            out vec3 v_texCoord;\n            uniform mat3 u_rotateMatrix;\n            void main()\n            {\n                vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n                gl_Position = czm_projection * vec4(p, 1.0);\n                v_texCoord = position.xyz;\n            }\n            ");
    }
    return (
      _createClass(SkyboxGround, [
        {
          key: "update",
          value: function (frameState, useHdr) {
            var that = this;
            if (
              this.show &&
              (frameState.mode === Cesium.SceneMode.SCENE3D ||
                frameState.mode === Cesium.SceneMode.MORPHING) &&
              frameState.passes.render
            ) {
              var context = frameState.context;
              if (this._sources !== this.sources) {
                this._sources = this.sources;
                var sources = this.sources;
                if (
                  !(
                    Cesium.defined(sources.positiveX) &&
                    Cesium.defined(sources.negativeX) &&
                    Cesium.defined(sources.positiveY) &&
                    Cesium.defined(sources.negativeY) &&
                    Cesium.defined(sources.positiveZ) &&
                    Cesium.defined(sources.negativeZ)
                  )
                )
                  throw new Cesium.DeveloperError(
                    "this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
                  );
                if (
                  _typeof(sources.positiveX) !== _typeof(sources.negativeX) ||
                  _typeof(sources.positiveX) !== _typeof(sources.positiveY) ||
                  _typeof(sources.positiveX) !== _typeof(sources.negativeY) ||
                  _typeof(sources.positiveX) !== _typeof(sources.positiveZ) ||
                  _typeof(sources.positiveX) !== _typeof(sources.negativeZ)
                )
                  throw new Cesium.DeveloperError(
                    "this.sources properties must all be the same type."
                  );
                "string" == typeof sources.positiveX
                  ? Cesium.loadCubeMap(context, this._sources).then(function (
                      cubeMap
                    ) {
                      (that._cubeMap =
                        that._cubeMap && that._cubeMap.destroy()),
                        (that._cubeMap = cubeMap);
                    })
                  : ((this._cubeMap = this._cubeMap && this._cubeMap.destroy()),
                    (this._cubeMap = new Cesium.CubeMap({
                      context: context,
                      source: sources,
                    })));
              }
              var command = this._command;
              if (
                ((command.modelMatrix =
                  Cesium.Transforms.eastNorthUpToFixedFrame(
                    frameState.camera._positionWC
                  )),
                !Cesium.defined(command.vertexArray) &&
                  that._cubeMap &&
                  ((command.uniformMap = {
                    u_cubeMap: function () {
                      return that._cubeMap;
                    },
                    u_rotateMatrix: function () {
                      return (
                        Cesium.defined(Cesium.Matrix4.getRotation) ||
                          (Cesium.Matrix4.getRotation =
                            Cesium.Matrix4.getMatrix3),
                        Cesium.Matrix4.getRotation(
                          command.modelMatrix,
                          new Cesium.Matrix3()
                        )
                      );
                    },
                  }),
                  (sources = Cesium.BoxGeometry.createGeometry(
                    Cesium.BoxGeometry.fromDimensions({
                      dimensions: new Cesium.Cartesian3(2, 2, 2),
                      vertexFormat: Cesium.VertexFormat.POSITION_ONLY,
                    })
                  )),
                  (frameState = this._attributeLocations =
                    Cesium.GeometryPipeline.createAttributeLocations(sources)),
                  (command.vertexArray = Cesium.VertexArray.fromGeometry({
                    context: context,
                    geometry: sources,
                    attributeLocations: frameState,
                    bufferUsage: Cesium.BufferUsage._DRAW,
                  })),
                  (command.renderState = Cesium.RenderState.fromCache({
                    blending: Cesium.BlendingState.ALPHA_BLEND,
                  }))),
                (Cesium.defined(command.shaderProgram) &&
                  this._useHdr === useHdr) ||
                  ((sources = new Cesium.ShaderSource({
                    defines: [useHdr ? "HDR" : ""],
                    sources: [this.SkyBoxFS],
                  })),
                  (command.shaderProgram = Cesium.ShaderProgram.fromCache({
                    context: context,
                    vertexShaderSource: this.SkyBoxVS,
                    fragmentShaderSource: sources,
                    attributeLocations: this._attributeLocations,
                  })),
                  (this._useHdr = useHdr)),
                Cesium.defined(this._cubeMap))
              )
                return command;
            }
          },
        },
        {
          key: "isDestroyed",
          value: function () {
            return !1;
          },
        },
        {
          key: "destroy",
          value: function () {
            var command = this._command;
            return (
              (command.vertexArray =
                command.vertexArray && command.vertexArray.destroy()),
              (command.shaderProgram =
                command.shaderProgram && command.shaderProgram.destroy()),
              (this._cubeMap = this._cubeMap && this._cubeMap.destroy()),
              Cesium.destroyObject(this)
            );
          },
        },
      ]),
      SkyboxGround
    );
  })(),
  OverviewMap = (function () {
    function OverviewMap(viewer, opt) {
      _classCallCheck(this, OverviewMap),
        (this.viewer = viewer),
        (this.opt = opt || {});
      (this.style = Object.assign(
        { height: 150, width: 200, bottom: 30, right: 60 },
        this.opt.style
      )),
        (this.rectangle = null),
        opt.url ? this.init() : console.log("缺少地图服务地址，请设置！");
    }
    return (
      _createClass(OverviewMap, [
        {
          key: "init",
          value: function () {
            (this.mapEle = window.document.createElement("div")),
              this.mapEle.setAttribute("id", "map2d"),
              (this.mapEle.style.height = this.style.height + "px"),
              (this.mapEle.style.width = this.style.width + "px"),
              (this.mapEle.style.position = "absolute"),
              (this.mapEle.style.bottom = this.style.bottom + "px"),
              (this.mapEle.style.right = this.style.right + "px"),
              document.body.appendChild(this.mapEle),
              (this.showStyle = {
                color: "#ff7800",
                weight: 1,
                fill: !0,
                stroke: !0,
                opacity: 1,
              }),
              (this.hideStyle = { fill: !1, opacity: 0 });
            var map$1 = map("map2d", {
              minZoom: 3,
              maxZoom: 17,
              center: [31.827107, 117.240601],
              zoom: 4,
              zoomControl: !1,
              attributionControl: !1,
            });
            tileLayer(this.opt.url).addTo(map$1),
              (this.map = map$1),
              (this.viewer.camera.percentageChanged = 0.01),
              this.viewer.camera.changed.addEventListener(
                this.sceneRenderHandler,
                this
              ),
              this.sceneRenderHandler();
          },
        },
        {
          key: "sceneRenderHandler",
          value: function () {
            var rectangle$1 = this.viewer.camera.computeViewRectangle(),
              extend = {},
              rectangle$1 =
                (rectangle$1
                  ? ((extend.ymin = Cesium.Math.toDegrees(rectangle$1.south)),
                    (extend.ymax = Cesium.Math.toDegrees(rectangle$1.north)),
                    (extend.xmin = Cesium.Math.toDegrees(rectangle$1.west)),
                    (extend.xmax = Cesium.Math.toDegrees(rectangle$1.east)))
                  : ((extend.ymin = -90),
                    (extend.ymax = 90),
                    (extend.xmin = -180),
                    (extend.xmin = 180)),
                latLng(extend.ymin, extend.xmin)),
              corner2 = latLng(extend.ymax, extend.xmax),
              rectangle$1 = latLngBounds(rectangle$1, corner2);
            this.rectangle
              ? this.rectangle.setBounds(rectangle$1)
              : (this.rectangle = rectangle(rectangle$1, this.showStyle).addTo(
                  this.map
                )),
              -180 == extend.xmin &&
              180 == extend.xmax &&
              90 == extend.ymax &&
              -90 == extend.ymin
                ? (this.map.setView([0, 0], 0),
                  this.rectangle.setStyle(this.hideStyle))
                : ((corner2 = rectangle$1.pad(0.5)),
                  this.map.fitBounds(corner2),
                  this.rectangle.setStyle(this.showStyle));
          },
        },
        {
          key: "hide",
          value: function () {
            this.mapEle && (this.mapEle.style.display = "none");
          },
        },
        {
          key: "show",
          value: function () {
            this.map && this.mapEle && (this.mapEle.style.display = "block");
          },
        },
        {
          key: "setStyle",
          value: function (style) {
            style && (this.showStyle = style);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.mapEle && document.body.removeChild(this.mapEle),
              this.viewer.camera.changed.removeEventListener(
                this.sceneRenderHandler,
                this
              );
          },
        },
      ]),
      OverviewMap
    );
  })(),
  selectModel = {
    isactivate: !1,
    handler: void 0,
    prompt: void 0,
    activate: function (viewer, callback) {
      var _this = this;
      viewer
        ? ((this.viewer = viewer),
          this.isactivate ||
            ((this.isactivate = !0),
            this.handler ||
              (this.handler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
            this.prompt || (this.prompt = new Prompt$1(this.viewer, {})),
            this.handler.setInputAction(function (evt) {
              evt = _this.viewer.scene.pick(evt.position);
              _this.prompt.destroy(),
                (_this.prompt = void 0),
                evt &&
                  evt.primitive instanceof Cesium.Cesium3DTileset &&
                  callback &&
                  callback(evt),
                _this.handler.destroy(),
                (_this.handler = void 0);
            }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
            this.handler.setInputAction(function (evt) {
              _this.prompt.update(evt.endPosition, "左键拾取");
            }, Cesium.ScreenSpaceEventType.MOUSE_MOVE)))
        : console.log("缺少地图对象--viewer");
    },
    disable: function () {
      this.isactivate &&
        ((this.isactivate = !1),
        this.handler && (this.handler.destroy(), (this.handler = void 0)),
        this.prompt && (this.prompt.destroy(), (this.prompt = void 0)));
    },
  },
  viewAround = {
    initView: void 0,
    removeEventHdl: void 0,
    startTime: void 0,
    isStop: !1,
    initHeading: void 0,
    viewer: void 0,
    start: function (viewer, opt) {
      this.viewer = viewer || window.viewer;
      var that,
        speed = opt.speed || 5;
      this.viewer
        ? (this.end(),
          (viewer.clock.shouldAnimate = !0),
          (this.isStop = !1),
          (this.initView = this.getCameraView()),
          (this.initHeading = this.initView.heading),
          (this.startTime = viewer.clock.currentTime),
          (that = this).removeEventHdl ||
            (this.removeEventHdl = viewer.clock.onTick.addEventListener(
              function () {
                var delTime;
                that.isStop ||
                  ((delTime = Cesium.JulianDate.secondsDifference(
                    viewer.clock.currentTime,
                    that.startTime
                  )),
                  (that.initView.heading = that.initHeading + delTime * speed),
                  (that.initView.duration = 0),
                  that.setCameraView(that.initView));
              }
            )))
        : console.log("绕点旋转缺少viewer对象");
    },
    end: function () {
      this.removeEventHdl &&
        (this.removeEventHdl(), (this.removeEventHdl = void 0)),
        (this.initView = void 0),
        (this.startTime = void 0),
        (this.isStop = !1),
        (this.initHeading = void 0);
    },
    stop: function () {
      this.isStop = !0;
    },
    goon: function () {
      (this.initView = this.getCameraView()),
        (this.startTime = viewer.clock.startTime),
        (this.initHeading = this.initView.heading),
        (this.isStop = !1);
    },
    setSpeed: function (speed) {
      this.speed = speed;
    },
    getCameraView: function () {
      var camera = this.viewer.camera,
        position = camera.position,
        heading = camera.heading,
        pitch = camera.pitch,
        camera = camera.roll,
        position = Cesium.Cartographic.fromCartesian(position);
      return {
        x: Cesium.Math.toDegrees(position.longitude),
        y: Cesium.Math.toDegrees(position.latitude),
        z: position.height,
        heading: Cesium.Math.toDegrees(heading),
        pitch: Cesium.Math.toDegrees(pitch),
        roll: Cesium.Math.toDegrees(camera),
      };
    },
    setCameraView: function (obj) {
      var position;
      obj &&
        ((position = Cesium.Cartesian3.fromDegrees(obj.x, obj.y, obj.z)),
        this.viewer.camera.flyTo({
          destination: position,
          orientation: {
            heading: Cesium.Math.toRadians(obj.heading || 0),
            pitch: Cesium.Math.toRadians(obj.pitch || 0),
            roll: Cesium.Math.toRadians(obj.roll || 0),
          },
          duration: void 0 === obj.duration ? 3 : obj.duration,
          complete: obj.complete,
        }));
    },
  },
  viewPoint = {
    removeEventLis: null,
    initHeading: 0,
    isStop: !1,
    center: null,
    startTime: null,
    viewer: void 0,
    angle: 5,
    start: function (viewer, opt) {
      var speed, range, pitch, that;
      (this.viewer = viewer || window.viewer),
        this.viewer
          ? (this.end(),
            (opt = (viewer = opt || {}).center),
            (speed = viewer.speed),
            (range = viewer.range),
            (pitch = viewer.pitch),
            (this.angle = speed || 5),
            (range = range || 5e3),
            (pitch = pitch || -60),
            (this.viewer.clock.shouldAnimate = !0),
            (this.center = opt),
            this.center &&
              (this.center instanceof Cesium.Cartesian3 ||
                (this.center = Cesium.Cartesian3.fromDegrees(
                  this.center[0],
                  this.center[1],
                  this.center[2] || 0
                )),
              (this.startTime = this.viewer.clock.currentTime),
              (this.isStop = !1),
              (that = this).removeEventLis ||
                (this.removeEventLis =
                  that.viewer.clock.onTick.addEventListener(function () {
                    var delTime, hpr;
                    that.isStop ||
                      ((delTime = Cesium.JulianDate.secondsDifference(
                        that.viewer.clock.currentTime,
                        that.startTime
                      )),
                      (delTime = that.initHeading + delTime * that.angle),
                      (hpr = that.getHpr({
                        heading: delTime,
                        pitch: pitch,
                        range: range,
                      })),
                      console.log(delTime),
                      that.viewer.camera.lookAt(that.center, hpr));
                  }))))
          : console.log("绕点旋转缺少viewer对象");
    },
    stop: function () {
      this.isStop = !0;
    },
    goon: function () {
      (this.startTime = this.viewer.clock.startTime), (this.isStop = !1);
    },
    end: function () {
      this.removeEventLis &&
        (this.removeEventLis(), (this.removeEventLis = null)),
        (this.initHeading = 0),
        (this.isStop = !1),
        (this.center = null),
        (this.startTime = null),
        that.viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
    },
    setSpeed: function (speed) {
      this.angle = speed;
    },
    getHpr: function (opt) {
      var heading = Cesium.Math.toRadians(opt.heading || 0),
        pitch = Cesium.Math.toRadians(opt.pitch || -60),
        opt = opt.range || 5e3;
      return new Cesium.HeadingPitchRange(heading, pitch, opt);
    },
    setCenter: function (center) {
      this.center = center;
    },
  },
  worldRotate = {
    start: function (viewer, obj, callback) {
      var v, i, q, x, y, z, interVal;
      obj.x && obj.y
        ? ((v = obj.v || 1),
          (i = 0),
          (q = obj.q || 2),
          (x = obj.x),
          (y = obj.y),
          (z = obj.z),
          (interVal = window.setInterval(function () {
            179 <= (x += v) && ((x = -180), i++),
              viewer.scene.camera.setView({
                destination: new Cesium.Cartesian3.fromDegrees(x, y, z || 2e7),
              }),
              i == q && (clearInterval(interVal), callback());
          }, 16)))
        : console.log("设定地球旋转时，并未传入经纬度！");
    },
  },
  TilesetClip = (function () {
    function TilesetClip(viewer, opt) {
      _classCallCheck(this, TilesetClip),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.tileset = opt.tileset),
        this.viewer &&
          this.tileset &&
          ((this.planeEntities = []),
          opt.dir
            ? (this.dir = Cesium.Cartesian3.normalize(
                opt.dir.clone(),
                new Cesium.Cartesian3()
              ))
            : null != opt.angle
            ? ((viewer = new Cesium.Cartesian3(0, 1, 0)),
              (viewer = this.angle2dir(Number(this.opt.angle), viewer.clone())),
              (this.dir = Cesium.Cartesian3.normalize(
                viewer.clone(),
                new Cesium.Cartesian3()
              )),
              (this.reverse = this.computeReverse(this.dir.clone())))
            : ((this.dir = Cesium.Cartesian3.normalize(
                new Cesium.Cartesian3(0, 0, -1),
                new Cesium.Cartesian3()
              )),
              (this.isrelyx = !0)),
          (this.distance = opt.distance || 0),
          (this.selectedPlane = void 0),
          (this.downHandler = void 0),
          (this.upHandler = void 0),
          (this.moveHandler = void 0),
          (this.scale = this.opt.scale || [1, 1]));
    }
    return (
      _createClass(TilesetClip, [
        {
          key: "start",
          value: function () {
            this.createClippingPlanes(),
              this.bindHandler(),
              this.viewer.scene.render();
          },
        },
        {
          key: "end",
          value: function () {
            this.downHandler &&
              (this.downHandler.destroy(), (this.downHandler = void 0)),
              this.upHandler &&
                (this.upHandler.destroy(), (this.upHandler = void 0)),
              this.moveHandler &&
                (this.moveHandler.destroy(), (this.moveHandler = void 0)),
              this.planeEntities.forEach(function (ent) {
                ent.show = !1;
              }),
              (this.selectedPlane = void 0),
              (this.distance = 0);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.downHandler &&
              (this.downHandler.destroy(), (this.downHandler = void 0)),
              this.upHandler &&
                (this.upHandler.destroy(), (this.upHandler = void 0)),
              this.moveHandler &&
                (this.moveHandler.destroy(), (this.moveHandler = void 0)),
              (this.selectedPlane = void 0);
            var that = this;
            this.planeEntities.forEach(function (ent) {
              that.viewer.entities.remove(ent);
            }),
              (this.planeEntities = []),
              (this.tileset.clippingPlanes =
                new Cesium.ClippingPlaneCollection());
          },
        },
        {
          key: "createClippingPlanes",
          value: function () {
            for (
              var clippingPlanes = new Cesium.ClippingPlaneCollection({
                  planes: [new Cesium.ClippingPlane(this.dir, 0)],
                  edgeWidth: 1,
                }),
                i = ((this.tileset.clippingPlanes = clippingPlanes), 0);
              i < clippingPlanes.length;
              ++i
            ) {
              var clipplane = clippingPlanes.get(i),
                clipplane = this.viewer.entities.add({
                  position: this.tileset.boundingSphere.center,
                  plane: {
                    dimensions: new Cesium.Cartesian2(
                      +this.tileset.boundingSphere.radius,
                      +this.tileset.boundingSphere.radius
                    ),
                    material: Cesium.Color.WHITE.withAlpha(0.3),
                    plane: new Cesium.CallbackProperty(
                      this.createPlaneUpdateFunction(clipplane),
                      !1
                    ),
                    outline: !0,
                    outlineColor: Cesium.Color.WHITE.withAlpha(0.3),
                  },
                });
              this.planeEntities.push(clipplane);
            }
          },
        },
        {
          key: "bindHandler",
          value: function () {
            var that = this;
            this.downHandler ||
              (this.downHandler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.upHandler ||
                (this.upHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              this.moveHandler ||
                (this.moveHandler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              this.downHandler.setInputAction(function (movement) {
                movement = that.viewer.scene.pick(movement.position);
                Cesium.defined(movement) &&
                  Cesium.defined(movement.id) &&
                  Cesium.defined(movement.id.plane) &&
                  ((that.selectedPlane = movement.id.plane),
                  (that.selectedPlane.material =
                    Cesium.Color.WHITE.withAlpha(0.1)),
                  (that.selectedPlane.outlineColor = Cesium.Color.WHITE),
                  (that.viewer.scene.screenSpaceCameraController.enableInputs =
                    !1));
              }, Cesium.ScreenSpaceEventType.LEFT_DOWN),
              this.upHandler.setInputAction(function () {
                Cesium.defined(that.selectedPlane) &&
                  ((that.selectedPlane.material =
                    Cesium.Color.WHITE.withAlpha(0.1)),
                  (that.selectedPlane.outlineColor = Cesium.Color.WHITE),
                  (that.selectedPlane = void 0)),
                  (that.viewer.scene.screenSpaceCameraController.enableInputs =
                    !0);
              }, Cesium.ScreenSpaceEventType.LEFT_UP),
              this.moveHandler.setInputAction(function (movement) {
                Cesium.defined(that.selectedPlane) &&
                  ((movement = that.isrelyx
                    ? -1 * (movement.endPosition.y - movement.startPosition.y)
                    : that.computeDis(movement)),
                  (that.distance += movement));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "createPlaneUpdateFunction",
          value: function (plane) {
            var that = this;
            return function () {
              return (plane.distance = that.distance), plane;
            };
          },
        },
        {
          key: "angle2dir",
          value: function (angle, olddir) {
            (angle = Cesium.Matrix3.fromRotationZ(
              Cesium.Math.toRadians(angle)
            )),
              (angle = Cesium.Matrix3.multiplyByVector(
                angle,
                olddir,
                new Cesium.Cartesian3()
              ));
            return Cesium.Cartesian3.normalize(angle, new Cesium.Cartesian3());
          },
        },
        {
          key: "computeReverse",
          value: function (dir) {
            Cesium.Cartesian3.dot(new Cesium.Cartesian3(0, 1, 0), dir.clone());
            return 1;
          },
        },
        {
          key: "computeDis",
          value: function (movement) {
            (movement.startPosition.x =
              movement.startPosition.x / this.scale[0]),
              (movement.startPosition.y =
                movement.startPosition.y / this.scale[1]),
              (movement.endPosition.x = movement.endPosition.x / this.scale[0]),
              (movement.endPosition.y = movement.endPosition.y / this.scale[1]);
            var ray1 = this.viewer.camera.getPickRay(movement.startPosition),
              ray1 = this.viewer.scene.globe.pick(ray1, this.viewer.scene),
              movement = this.viewer.camera.getPickRay(movement.endPosition),
              movement = this.viewer.scene.globe.pick(
                movement,
                this.viewer.scene
              ),
              movement = Cesium.Cartesian3.subtract(
                movement,
                ray1,
                new Cesium.Cartesian3()
              );
            return Cesium.Cartesian3.dot(movement, this.dir);
          },
        },
      ]),
      TilesetClip
    );
  })(),
  PointLight = (function () {
    function PointLight(tileset, opt) {
      _classCallCheck(this, PointLight),
        (this.opt = opt || {}),
        (this.tileset = tileset),
        (this.lights = opt.lights || []),
        this.lights.length < 1 ||
          ((this.customShader = this.getUnformsShader()),
          (this.tileset.customShader = this.customShader));
    }
    return (
      _createClass(PointLight, [
        {
          key: "getUnformsShader",
          value: function () {
            for (
              var uniforms = {}, inputText = "", ids = [], i = 0;
              i < this.lights.length;
              i++
            ) {
              var item = this.lights[i],
                id = item.id,
                position = item.position,
                color = (item.targetPosition, item.color),
                length = item.length,
                item = (item.innerRange, item.outRange, item.intensity);
              position &&
                ((id =
                  id ||
                  new Date().getTime() + "-" + Math.ceil(1e3 * Math.random())),
                ids.push(id),
                (uniforms["u_lightPosition_".concat(id)] = {
                  type: Cesium.UniformType.VEC3,
                  value: position,
                }),
                (uniforms["u_lightColor_".concat(id)] = {
                  type: Cesium.UniformType.VEC4,
                  value: color || Cesium.Color.RED,
                }),
                (uniforms["u_length_".concat(id)] = {
                  type: Cesium.UniformType.FLOAT,
                  value: length || 500,
                }),
                (uniforms["u_intensity_".concat(id)] = {
                  type: Cesium.UniformType.FLOAT,
                  value: item || 10,
                }),
                (inputText += "\n                vec4 fcolor_"
                  .concat(
                    id,
                    " = pointLight(\n                    u_lightColor_"
                  )
                  .concat(id, ",\n                    u_lightPosition_")
                  .concat(
                    id,
                    ",\n                    positionWC,\n                    positionEC,\n                    normalEC,\n                    pbrParameters,\n                    u_intensity_"
                  )
                  .concat(id, ",\n                    u_length_")
                  .concat(id, "\n                );\n            ")));
            }
            var mixText = "",
              fragmentShaderText =
                (1 < ids.length
                  ? ((mixText =
                      "\n            vec3 finalColor = mix(\n                fcolor_"
                        .concat(ids[0], ".rgb, \n                fcolor_")
                        .concat(
                          ids[1],
                          ".rgb,\n                0.5);\n            "
                        )),
                    ids.forEach(function (id, index) {
                      1 < index &&
                        (mixText +=
                          "\n                    finalColor = mix(\n                            finalColor.rgb,\n                            fcolor_".concat(
                            id,
                            ".rgb,\n                            0.5\n                        );\n                "
                          ));
                    }))
                  : (mixText = "vec3 finalColor = fcolor_".concat(
                      ids[0],
                      ".rgb;"
                    )),
                "\n            vec4 pointLight(\n                vec4 lightColor,\n                vec3 lightPosition,\n                vec3 positionWC,\n                vec3 positionEC,\n                vec3 normalEC,\n                czm_pbrParameters pbrParameters,\n                float intensity,\n                float plength\n                ){\n                    // 光源-片元向量\n                    vec3 lightToPoint = (czm_view * vec4(lightPosition,1.0)).xyz - positionEC;\n                    vec3 lightToPoint_dir = normalize(lightToPoint);\n                    // 计算光源位置-偏远位置组成的向量 与 光线向量的 点乘，即当前片元的颜色\n                    // 颜色插值\n                    float inLight = 1.0;;\n                    // 判断点光源和片元的位置关系 0-垂直 1-正上方\n                    float light = inLight * clamp(dot(normalEC,lightToPoint_dir),0.0,1.0); //漫反射\n                    // 光线衰减\n                    vec3 light1Dir = positionWC - lightPosition;\n                    float lDistance = 1.0;\n                    // 根据与光源距离 计算强度\n                    lDistance = 1.0 - min( ( length( light1Dir ) / plength ), 1.0 );\n                    // 超出范围 变为模型黑色  范围内 光强递减\n                    if(lDistance < 0.00001 ) {\n                        return vec4(0.0);\n                    }else{\n                        vec3 diffuseColor = pbrParameters.diffuseColor;\n                        // 边缘变黑 如果不想变黑 就去掉light\n                        diffuseColor *= light * lightColor.rgb; \n                        diffuseColor *=  lDistance * intensity;\n                        return vec4(diffuseColor,lDistance);\n                    }\n                }\n\n            void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material){\n                    material.diffuse = vec3(1.0,1.0,1.0); // 设置模型基地色为白色 防止出现颜色偏差\n                    vec3 positionWC = fsInput.attributes.positionWC;\n                    vec3 normalEC = fsInput.attributes.normalEC;\n                    vec3 positionEC = fsInput.attributes.positionEC;\n                    czm_pbrParameters pbrParameters;\n                    pbrParameters.diffuseColor = material.diffuse;\n                    // 设置反射率\n                    pbrParameters.f0 = vec3(0.5);\n                    // 设置粗糙程度\n                    pbrParameters.roughness = 1.0;\n                    // 设置照明参数\n                    "
                  .concat(inputText, ";\n                    ")
                  .concat(
                    mixText,
                    ";\n                    material.diffuse *= finalColor;\n                }\n            "
                  ));
            return new Cesium.CustomShader({
              lightingModel: Cesium.LightingModel.UNLIT,
              uniforms: uniforms,
              fragmentShaderText: fragmentShaderText,
            });
          },
        },
        {
          key: "destroy",
          value: function () {
            this.tileset.customShader = void 0;
          },
        },
      ]),
      PointLight
    );
  })(),
  TilesetCut = (function () {
    function TilesetCut(tileset, opt) {
      _classCallCheck(this, TilesetCut),
        tileset
          ? ((this.tileset = tileset),
            (this.opt = opt || {}),
            (this._iscutOutter = this.opt.iscutOutter),
            (this.cutRegions = []),
            (tileset = this.tileset.boundingSphere.center),
            (opt = Cesium.Transforms.eastNorthUpToFixedFrame(tileset)),
            (this.modelMatrix = Cesium.Matrix4.inverse(
              opt,
              new Cesium.Matrix4()
            )),
            (this.canvas = void 0))
          : console.log("缺少模型");
    }
    return (
      _createClass(TilesetCut, [
        {
          key: "iscutOutter",
          get: function () {
            return this._iscutOutter;
          },
          set: function (val) {
            (this._iscutOutter = val), this.updateShader();
          },
        },
        {
          key: "addRegion",
          value: function (attr) {
            var attr = attr || {},
              positions = attr.positions,
              id =
                (id = attr.id) ||
                new Date().getTime() +
                  "" +
                  Number(1e3 * Math.random()).toFixed(0);
            !positions || positions.length < 3
              ? console.log("缺少裁剪面坐标")
              : (-1 ==
                (attr = this.cutRegions.findIndex(function (item) {
                  return item.id === id;
                }))
                  ? this.cutRegions.push({ id: id, positions: positions })
                  : (this.cutRegions[attr].positions = positions),
                this.updateShader());
          },
        },
        {
          key: "removeRegionById",
          value: function (id) {
            var index;
            id
              ? -1 !=
                  (index = this.cutRegions.findIndex(function (item) {
                    return item.id === id;
                  })) && this.cutRegions.splice(index, 1)
              : (this.cutRegions = []),
              this.updateShader();
          },
        },
        {
          key: "destroy",
          value: function () {
            this.tileset.customShader = void 0;
          },
        },
        {
          key: "updateShader",
          value: function () {
            var _this = this,
              allUniforms = {
                u_inverseModel: {
                  type: Cesium.UniformType.MAT4,
                  value: this.modelMatrix.clone(),
                },
                u_unionCutRegions: {
                  type: Cesium.UniformType.BOOL,
                  value: this._iscutOutter,
                },
              },
              fs = "";
            this.cutRegions.forEach(function (element) {
              var uniforms = _this.createUniforms(
                element.positions,
                element.id
              );
              (allUniforms = Cesium.combine(allUniforms, uniforms)),
                (fs += "\n                vec4 color_"
                  .concat(element.id, " = textureMapRect(u_rect_")
                  .concat(element.id, ", u_map_")
                  .concat(
                    element.id,
                    ", xy);\n                cutColor *= color_"
                  )
                  .concat(element.id, ";\n            "));
            }),
              (fs +=
                "\n            if (u_unionCutRegions) {\n                material.diffuse *= (vec3(1.0) - cutColor.rgb);\n            } else {\n                material.diffuse *= cutColor.rgb;\n            }\n            if (material.diffuse.r <= 0.0001 && material.diffuse.g <= 0.0001 && material.diffuse.b <= 0.0001) {\n                discard;\n            }\n        "),
              (this.tileset.customShader = new Cesium.CustomShader({
                uniforms: allUniforms,
                fragmentShaderText: " \n            "
                  .concat(
                    "\n            vec4 textureMapRect(vec4 rect, sampler2D map, vec2 xy) {\n                // 判断当前图元坐标和多边形关系 如果在多边形内 进行纹素拾取\n                if (xy.x >= rect.x && xy.x <= rect.z && xy.y >= rect.y && xy.y <= rect.w) {\n                    float w = rect.z - rect.x;\n                    float h = rect.w - rect.y;\n                    float s = (xy.x - rect.x) / w;\n                    float t = (xy.y - rect.y) / h;\n                    vec4 color = texture(map, vec2(s, 1.0 - t));\n                    return color;\n                }\n                return vec4(1.0);\n            }\n        ",
                    "\n            void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {\n                vec4 positionMC = u_inverseModel * vec4(fsInput.attributes.positionWC, 1.0);\n                vec2 xy = positionMC.xy;\n                vec4 cutColor = vec4(1.0);\n                "
                  )
                  .concat(fs, "\n            }"),
              }));
          },
        },
        {
          key: "createUniforms",
          value: function (positions, id) {
            var _this2 = this;
            if (positions && !(positions.length < 3)) {
              id =
                id ||
                Math.ceil(1e5 * Math.random()) +
                  "_" +
                  Math.ceil(1e5 * Math.random());
              var xs = [],
                ys = [],
                zs = [],
                modelPoints = positions.map(function (p) {
                  p = Cesium.Matrix4.multiplyByPoint(
                    _this2.modelMatrix,
                    p,
                    new Cesium.Cartesian3()
                  );
                  return xs.push(p.x), ys.push(p.y), zs.push(p.z), p;
                }),
                rect = new Cesium.Cartesian4(
                  Math.min.apply(null, xs),
                  Math.min.apply(null, ys),
                  Math.max.apply(null, xs),
                  Math.max.apply(null, ys)
                ),
                canvas = document.createElement("canvas"),
                width =
                  ((canvas.width = 1024),
                  (canvas.height = 1024),
                  rect.z - rect.x),
                height = rect.w - rect.y,
                ctx = canvas.getContext("2d");
              (ctx.fillStyle = "#fff"),
                ctx.fillRect(0, 0, canvas.width, canvas.height),
                ctx.beginPath(),
                ctx.moveTo(
                  (canvas.width * (modelPoints[0].x - rect.x)) / width,
                  (canvas.height * (modelPoints[0].y - rect.y)) / height
                );
              for (var i = 1; i < modelPoints.length; i++)
                ctx.lineTo(
                  (canvas.width * (modelPoints[i].x - rect.x)) / width,
                  (canvas.height * (modelPoints[i].y - rect.y)) / height
                );
              ctx.closePath(),
                (ctx.fillStyle = "#000"),
                ctx.fill(),
                (this.canvas = canvas);
              positions = {};
              return (
                (positions["u_rect_".concat(id)] = {
                  type: Cesium.UniformType.VEC4,
                  value: rect,
                }),
                (positions["u_map_".concat(id)] = {
                  type: Cesium.UniformType.SAMPLER_2D,
                  value: new Cesium.TextureUniform({ url: canvas.toDataURL() }),
                  minificationFilter: Cesium.TextureMinificationFilter.LINEAR,
                  magnificationFilter: Cesium.TextureMagnificationFilter.LINEAR,
                }),
                positions
              );
            }
            console.log("缺少裁剪面坐标");
          },
        },
      ]),
      TilesetCut
    );
  })(),
  Flat = (function () {
    function Flat(tileset, opt) {
      _classCallCheck(this, Flat),
        _defineProperty(this, "getUniqueArray", function (arr) {
          return arr.filter(function (item, index, arr) {
            return arr.indexOf(item, 0) === index;
          });
        }),
        tileset &&
          ((this.tileset = tileset),
          (this.opt = opt || {}),
          (this.flatHeight = this.opt.flatHeight || 0),
          (this.center = tileset.boundingSphere.center.clone()),
          (this.matrix = Cesium.Transforms.eastNorthUpToFixedFrame(
            this.center.clone()
          )),
          (this.localMatrix = Cesium.Matrix4.inverse(
            this.matrix,
            new Cesium.Matrix4()
          )),
          (this.regionList = []),
          (this.localPositionsArr = []));
    }
    return (
      _createClass(Flat, [
        {
          key: "addRegion",
          value: function (attr) {
            var _this = this,
              _ref = attr || {};
            _ref.positions,
              _ref.height,
              _ref.id ||
                (new Date().getTime(), Number(1e3 * Math.random()).toFixed(0));
            this.regionList.push(attr);
            for (var i = 0; i < this.regionList.length; i++) {
              var _positions = this.regionList[i].positions,
                _positions = this.cartesiansToLocal(_positions);
              this.localPositionsArr.push(_positions);
            }
            for (
              var _ref = this.getIsinPolygonFun(this.localPositionsArr),
                str = "",
                _i = 0;
              _i < this.localPositionsArr.length;
              _i++
            )
              !(function (_i) {
                var _i = _this.localPositionsArr[_i],
                  n = _i.length,
                  instr = "";
                _i.forEach(function (coordinate, index) {
                  instr += "points_"
                    .concat(n, "[")
                    .concat(index, "] = vec2(")
                    .concat(coordinate[0], ", ")
                    .concat(coordinate[1], ");\n");
                }),
                  (str += "\n                "
                    .concat(instr, "\n                if(isPointInPolygon_")
                    .concat(
                      n,
                      "(position2D)){\n                    vec4 tileset_local_position_transformed = vec4(tileset_local_position.x, tileset_local_position.y, ground_z, 1.0);\n                    vec4 model_local_position_transformed = czm_inverseModel * u_tileset_localToWorldMatrix * tileset_local_position_transformed;\n                    vsOutput.positionMC.xy = model_local_position_transformed.xy;\n                    vsOutput.positionMC.z = model_local_position_transformed.z+ modelMC.z*0.002;\n                    return;\n                }"
                    ));
              })(_i);
            this.updateShader(_ref, str);
          },
        },
        {
          key: "removeRegionById",
          value: function (id) {
            var _this2 = this;
            if (id) {
              (this.regionList = this.regionList.filter(function (attr) {
                return attr.id != id;
              })),
                (this.localPositionsArr = []);
              for (var i = 0; i < this.regionList.length; i++) {
                var positions = this.regionList[i].positions,
                  positions = this.cartesiansToLocal(positions);
                this.localPositionsArr.push(positions);
              }
              for (
                var funstr = this.getIsinPolygonFun(this.localPositionsArr),
                  str = "",
                  _i2 = 0;
                _i2 < this.localPositionsArr.length;
                _i2++
              )
                !(function (_i2) {
                  var _i2 = _this2.localPositionsArr[_i2],
                    n = _i2.length,
                    instr = "";
                  _i2.forEach(function (coordinate, index) {
                    instr += "points_"
                      .concat(n, "[")
                      .concat(index, "] = vec2(")
                      .concat(coordinate[0], ", ")
                      .concat(coordinate[1], ");\n");
                  }),
                    (str += "\n                "
                      .concat(instr, "\n                if(isPointInPolygon_")
                      .concat(
                        n,
                        "(position2D)){\n                    vec4 tileset_local_position_transformed = vec4(tileset_local_position.x, tileset_local_position.y, ground_z, 1.0);\n                    vec4 model_local_position_transformed = czm_inverseModel * u_tileset_localToWorldMatrix * tileset_local_position_transformed;\n                    vsOutput.positionMC.xy = model_local_position_transformed.xy;\n                    vsOutput.positionMC.z = model_local_position_transformed.z+ modelMC.z*0.002;\n                    return;\n                }"
                      ));
                })(_i2);
              this.updateShader(funstr, str);
            }
          },
        },
        {
          key: "destroy",
          value: function () {
            this.tileset.customShader = void 0;
          },
        },
        {
          key: "getIsinPolygonFun",
          value: function (polygons) {
            var polygons = polygons.map(function (polygon) {
                return polygon.length;
              }),
              polygons = this.getUniqueArray(polygons),
              str = "";
            return (
              polygons.forEach(function (length) {
                str += "\n                vec2 points_"
                  .concat(length, "[")
                  .concat(length, "];\n                bool isPointInPolygon_")
                  .concat(
                    length,
                    "(vec2 point){\n                int nCross = 0; // 交点数\n                const int n = "
                  )
                  .concat(
                    length,
                    "; \n                for(int i = 0; i < n; i++){\n                    vec2 p1 = points_"
                  )
                  .concat(length, "[i];\n                    vec2 p2 = points_")
                  .concat(
                    length,
                    "[int(mod(float(i+1),float(n)))];\n                    if(p1[1] == p2[1]){\n                        continue;\n                    }\n                    if(point[1] < min(p1[1], p2[1])){\n                        continue;\n                    }\n                    if(point[1] >= max(p1[1], p2[1])){\n                        continue;\n                    }\n                    float x = p1[0] + ((point[1] - p1[1]) * (p2[0] - p1[0])) / (p2[1] - p1[1]);\n                    if(x > point[0]){\n                     nCross++;\n                    }\n                }\n\n                return int(mod(float(nCross), float(2))) == 1;\n                }\n            "
                  );
              }),
              str
            );
          },
        },
        {
          key: "updateShader",
          value: function (vtx1, vtx2) {
            vtx1 = new Cesium.CustomShader({
              uniforms: {
                u_tileset_localToWorldMatrix: {
                  type: Cesium.UniformType.MAT4,
                  value: this.matrix,
                },
                u_tileset_worldToLocalMatrix: {
                  type: Cesium.UniformType.MAT4,
                  value: this.localMatrix,
                },
                u_flatHeight: {
                  type: Cesium.UniformType.FLOAT,
                  value: this.flatHeight,
                },
              },
              vertexShaderText:
                "\n            // 所有isPointInPolygon函数\n            "
                  .concat(
                    vtx1,
                    "\n            void vertexMain(VertexInput vsInput, inout czm_modelVertexOutput vsOutput){\n                vec3 modelMC = vsInput.attributes.positionMC;\n                vec4 model_local_position = vec4(modelMC.x, modelMC.y, modelMC.z, 1.0);\n                vec4 tileset_local_position = u_tileset_worldToLocalMatrix * czm_model * model_local_position;\n                vec2 position2D = vec2(tileset_local_position.x,tileset_local_position.y);\n                float ground_z = 0.0 + u_flatHeight;\n                // 多个多边形区域\n                "
                  )
                  .concat(vtx2, "\n            }"),
            });
            this.tileset.customShader = vtx1;
          },
        },
        {
          key: "cartesiansToLocal",
          value: function (positions) {
            for (var arr = [], i = 0; i < positions.length; i++) {
              var position = positions[i],
                position = Cesium.Matrix4.multiplyByPoint(
                  this.localMatrix,
                  position.clone(),
                  new Cesium.Cartesian3()
                );
              arr.push([position.x, position.y]);
            }
            return arr;
          },
        },
      ]),
      Flat
    );
  })(),
  Sunshine = (function () {
    function Sunshine(viewer, opt) {
      _classCallCheck(this, Sunshine),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this._startTime =
          opt.startTime ||
          Cesium.JulianDate.fromDate(
            new Date().setHours(8),
            new Cesium.JulianDate()
          )),
        this._startTime instanceof Date &&
          (this._startTime = Cesium.JulianDate.fromDate(
            this._startTime,
            new Cesium.JulianDate()
          )),
        (this._endTime = opt.endTime),
        this._endTime instanceof Date &&
          (this._endTime = Cesium.JulianDate.fromDate(
            this._endTime,
            new Cesium.JulianDate()
          )),
        (this.oldShouldAnimate = this.viewer.clock.shouldAnimate),
        (this.multiplier = opt.multiplier || 60),
        (this.oldenableLighting = this.viewer.scene.globe.enableLighting),
        (this.oldshadows = this.viewer.shadows);
    }
    return (
      _createClass(Sunshine, [
        {
          key: "start",
          value: function () {
            (this.viewer.clock.currentTime = this._startTime.clone()),
              (this.viewer.clock.startTime = this._startTime.clone()),
              (this.viewer.clock.shouldAnimate = !0),
              (this.viewer.clock.multiplier = this.multiplier),
              (this.viewer.scene.globe.enableLighting = !0),
              (this.viewer.shadows = !0),
              (this.viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP),
              this._endTime &&
                (this.viewer.clock.endTime = this._endTime.clone());
          },
        },
        {
          key: "end",
          value: function () {
            (this.viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED),
              (this.viewer.clock.shouldAnimate = this.oldShouldAnimate),
              (this.viewer.clock.multiplier = 1),
              (this.viewer.scene.globe.enableLighting = this.oldenableLighting),
              (this.viewer.shadows = this.oldshadows);
          },
        },
        {
          key: "destroy",
          value: function () {
            (this.viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED),
              (this.viewer.clock.shouldAnimate = this.oldShouldAnimate),
              (this.viewer.clock.multiplier = 1),
              (this.viewer.scene.globe.enableLighting = this.oldenableLighting);
          },
        },
        {
          key: "pause",
          value: function () {
            this.viewer.clock.shouldAnimate = !this.viewer.clock.shouldAnimate;
          },
        },
        {
          key: "startTime",
          get: function () {
            return this._startTime;
          },
          set: function (time) {
            time &&
              (this._startTime instanceof Date
                ? (this._startTime = Cesium.JulianDate.fromDate(
                    this._startTime,
                    new Cesium.JulianDate()
                  ))
                : (this._startTime = time.clone()),
              this.start());
          },
        },
        {
          key: "endTime",
          get: function () {
            return this._endTime;
          },
          set: function (time) {
            time &&
              (this._endTime instanceof Date
                ? (this._endTime = Cesium.JulianDate.fromDate(
                    this._startTime,
                    new Cesium.JulianDate()
                  ))
                : (this._endTime = time.clone()),
              this.start());
          },
        },
      ]),
      Sunshine
    );
  })(),
  LimitHeight = (function () {
    function LimitHeight(viewer, opt) {
      _classCallCheck(this, LimitHeight),
        (this.viewer = viewer),
        (this.positions = opt.positions),
        (this.bottomHeight = Number(opt.bottomHeight)),
        null != this.bottomHeight &&
          ((this.topHeight = Number(opt.topHeight) || Number.MAX_VALUE),
          (viewer = opt.color || "#ff0000"),
          (this.color =
            viewer instanceof Cesium.Color
              ? viewer
              : Cesium.Color.fromCssColorString(viewer)),
          (this.colorAlpha = opt.alpha || 0.8),
          (this.primitive = void 0),
          this.init());
    }
    return (
      _createClass(LimitHeight, [
        {
          key: "init",
          value: function () {
            var polygonInstance = new Cesium.GeometryInstance({
              geometry: new Cesium.PolygonGeometry({
                polygonHierarchy: new Cesium.PolygonHierarchy(this.positions),
                height: this.bottomHeight,
                extrudedHeight: this.topHeight,
              }),
              attributes: {
                color: Cesium.ColorGeometryInstanceAttribute.fromColor(
                  this.color.withAlpha(this.colorAlpha)
                ),
              },
            });
            this.primitive = this.viewer.scene.primitives.add(
              new Cesium.ClassificationPrimitive({
                geometryInstances: polygonInstance,
                releaseGeometryInstances: !1,
                classificationType: Cesium.ClassificationType.CESIUM_3D_TILE,
              })
            );
          },
        },
        {
          key: "setHeight",
          value: function (h) {
            var surface, cartographic;
            this.primitive &&
              ((cartographic = Cesium.Cartographic.fromCartesian(
                this.primitive._primitive._boundingSpheres[0].center
              )),
              (surface = Cesium.Cartesian3.fromRadians(
                cartographic.longitude,
                cartographic.latitude,
                this.baseHeight
              )),
              (cartographic = Cesium.Cartesian3.fromRadians(
                cartographic.longitude,
                cartographic.latitude,
                h
              )),
              (h = Cesium.Cartesian3.subtract(
                cartographic,
                surface,
                new Cesium.Cartesian3()
              )),
              (this.primitive._primitive.modelMatrix =
                Cesium.Matrix4.fromTranslation(h)));
          },
        },
        {
          key: "destroy",
          value: function () {
            this.primitive &&
              (this.viewer.scene.primitives.remove(this.primitive),
              (this.primitive = null));
          },
        },
      ]),
      LimitHeight
    );
  })();
function getPostStageFragmentShader(viewShed, isTerrain) {
  var usesDepthTexture = viewShed._usesDepthTexture,
    polygonOffsetSupported = viewShed._polygonOffsetSupported,
    isPointLight = viewShed._isPointLight,
    isSpotLight = viewShed._isSpotLight,
    hasCascades = 1 < viewShed._numberOfCascades,
    debugCascadeColors = viewShed.debugCascadeColors,
    fsSource = "",
    fsSource =
      (isPointLight
        ? (fsSource += "#define USE_CUBE_MAP_SHADOW\n")
        : usesDepthTexture &&
          (fsSource += "#define USE_SHADOW_DEPTH_TEXTURE\n"),
      viewShed.softShadows &&
        !isPointLight &&
        (fsSource += "#define USE_SOFT_SHADOWS\n"),
      (fsSource =
        (fsSource +=
          "uniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\n") +
        (isPointLight
          ? "uniform samplerCube shadowMap_textureCube; \n"
          : "uniform sampler2D shadowMap_texture; \n") +
        "uniform mat4 shadowMap_matrix; \nuniform vec3 shadowMap_lightDirectionEC; \nuniform vec4 shadowMap_lightPositionEC; \nuniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \nuniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \nuniform vec4 viewShed_frontColor; \nuniform vec4 viewShed_backColor; \nuniform float viewShed_Fov; \nuniform float viewShed_Far;\n\nin vec2 v_textureCoordinates;\n\nstruct sg_shadowParameters{ \n        #ifdef USE_CUBE_MAP_SHADOW\n\n            vec3 texCoords;\n\n        #else\n\n            vec2 texCoords;\n\n        #endif\n\n            float depthBias;\n            float depth;\n            float nDotL;\n            vec2 texelStepSize;\n            float normalShadingSmooth;\n            float darkness;\n        };\n#ifdef USE_CUBE_MAP_SHADOW\nfloat sg_sampleShadowMap(samplerCube shadowMap, vec3 d)\n{\n    return czm_unpackDepth(textureCube(shadowMap, d));\n}\nfloat sg_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)\n{\n    return step(depth, sg_sampleShadowMap(shadowMap, uv));\n}\nfloat sg_shadowVisibility(samplerCube shadowMap, sg_shadowParameters shadowParameters)\n{\n    float depthBias = shadowParameters.depthBias;\n    float depth = shadowParameters.depth;\n    float nDotL = shadowParameters.nDotL;\n    float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n    float darkness = shadowParameters.darkness;\n    vec3 uvw = shadowParameters.texCoords;\n\n    depth -= depthBias;\n    float visibility = sg_shadowDepthCompare(shadowMap, uvw, depth);\n    return visibility;\n}\n#else\nfloat sg_sampleShadowMap(sampler2D shadowMap, vec2 uv)\n{\n#ifdef USE_SHADOW_DEPTH_TEXTURE\n    return texture(shadowMap, uv).r;\n#else\n    return czm_unpackDepth(texture(shadowMap, uv));\n#endif\n}\nfloat sg_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)\n{\n    return step(depth, sg_sampleShadowMap(shadowMap, uv));\n}\nfloat sg_shadowVisibility(sampler2D shadowMap, sg_shadowParameters shadowParameters)\n{\n    float depthBias = shadowParameters.depthBias;\n    float depth = shadowParameters.depth;\n    float nDotL = shadowParameters.nDotL;\n    float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n    float darkness = shadowParameters.darkness;\n    vec2 uv = shadowParameters.texCoords;\n\n    depth -= depthBias;\n#ifdef USE_SOFT_SHADOWS\n    vec2 texelStepSize = shadowParameters.texelStepSize;\n    float radius = 1.0;\n    float dx0 = -texelStepSize.x * radius;\n    float dy0 = -texelStepSize.y * radius;\n    float dx1 = texelStepSize.x * radius;\n    float dy1 = texelStepSize.y * radius;\n    float visibility = (\n        sg_shadowDepthCompare(shadowMap, uv, depth) +\n        sg_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\n        sg_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\n        sg_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\n        sg_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\n        sg_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\n        sg_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\n        sg_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\n        sg_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\n    ) * (1.0 / 9.0);\n#else\n    float visibility = sg_shadowDepthCompare(shadowMap, uv, depth);\n#endif\n\n    return visibility;\n}\n#endif\nvec4 getPositionEC(float depth) \n{ \n    vec2 xy = vec2((v_textureCoordinates.x * 2.0 - 1.0), (v_textureCoordinates.y * 2.0 - 1.0));\n    float z = (depth - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n    vec4 posInCamera = czm_inverseProjection * vec4(xy, z, 1.0);\n    posInCamera = posInCamera / posInCamera.w;\n    return posInCamera;\n} \nvec3 getNormalEC() \n{ \n    return vec3(1.0); \n} \n\n") +
        "void main() \n{ \n    float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n    if(depth > 0.999999)\n    {\n        out_FragColor = texture(colorTexture, v_textureCoordinates);\n        return;\n    }\n    vec4 positionEC = getPositionEC(depth); \n    vec3 normalEC = getNormalEC(); \n    float z = -positionEC.z; \n" +
        "    sg_shadowParameters shadowParameters; \n    shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; \n    shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; \n    shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; \n    shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; \n");
  return (
    isTerrain
      ? (fsSource += "    shadowParameters.depthBias *= max(z * 0.01, 1.0); \n")
      : polygonOffsetSupported ||
        (fsSource +=
          "    shadowParameters.depthBias *= mix(1.0, 100.0, z * 0.0015); \n"),
    (fsSource =
      fsSource +
      (isPointLight
        ? "    vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz; \n    float distance = length(directionEC); \n    directionEC = normalize(directionEC); \n    float radius = shadowMap_lightPositionEC.w; \n    // Stop early if the fragment is beyond the point light radius \n    if (distance > radius) \n    { \n        out_FragColor = texture(colorTexture, v_textureCoordinates);\n        return; \n    } \n    vec3 directionWC  = czm_inverseViewRotation * directionEC; \n    shadowParameters.depth = distance / radius; \n    shadowParameters.texCoords = directionWC; \n    float visibility = sg_shadowVisibility(shadowMap_textureCube, shadowParameters); \n"
        : isSpotLight
        ? "    vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz; \n    float distance = length(directionEC); \n    if(distance > viewShed_Far)\n    {\n        out_FragColor = texture(colorTexture, v_textureCoordinates);\n        return;\n    }\n    vec4 shadowPosition = shadowMap_matrix * positionEC; \n    // Spot light uses a perspective projection, so perform the perspective divide \n    shadowPosition /= shadowPosition.w; \n    // Stop early if the fragment is not in the shadow bounds \n    if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n    { \n        out_FragColor = texture(colorTexture, v_textureCoordinates);\n        return; \n    } \n    shadowParameters.texCoords = shadowPosition.xy; \n    shadowParameters.depth = shadowPosition.z; \n    float visibility = sg_shadowVisibility(shadowMap_texture, shadowParameters); \n"
        : hasCascades
        ? "    float maxDepth = shadowMap_cascadeSplits[1].w; \n    // Stop early if the eye depth exceeds the last cascade \n    if (z > maxDepth) \n    { \n        out_FragColor = texture(colorTexture, v_textureCoordinates);\n        return; \n    } \n    // Get the cascade based on the eye-space z \n    vec4 weights = czm_cascadeWeights(z); \n    // Transform position into the cascade \n    vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC; \n    // Get visibility \n    shadowParameters.texCoords = shadowPosition.xy; \n    shadowParameters.depth = shadowPosition.z; \n    float visibility = sg_shadowVisibility(shadowMap_texture, shadowParameters); \n    // Fade out shadows that are far away \n    float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z; \n    float fade = max((z - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0); \n    visibility = mix(visibility, 1.0, fade); \n"
        : "    vec4 shadowPosition = shadowMap_matrix * positionEC; \n    // Stop early if the fragment is not in the shadow bounds \n    if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n    { \n        out_FragColor = texture(colorTexture, v_textureCoordinates);\n        return; \n    } \n    shadowParameters.texCoords = shadowPosition.xy; \n    shadowParameters.depth = shadowPosition.z; \n    float visibility = sg_shadowVisibility(shadowMap_texture, shadowParameters); \n") +
      ("    vec4 color = texture(colorTexture, v_textureCoordinates);\n" +
        (hasCascades && debugCascadeColors
          ? "    color *= czm_cascadeColor(weights); \n"
          : "") +
        "    if(visibility > 0.0) \n        out_FragColor = vec4(color.rgb * (1.0 - viewShed_frontColor.a) + viewShed_frontColor.rgb * viewShed_frontColor.a, color.a); \n    else \n        out_FragColor = vec4(color.rgb * (1.0 - viewShed_backColor.a) + viewShed_backColor.rgb * viewShed_backColor.a, color.a); \n} \n"))
  );
}
var VisualField = (function () {
    function VisualField(viewer, options) {
      if ((_classCallCheck(this, VisualField), !Cesium.defined(viewer)))
        throw new Cesium.DeveloperError("缺少地图对象！");
      (this.options = options || {}), (this._scene = viewer.scene);
      viewer = options.cameraOptions || {};
      (this._enabled = Cesium.defaultValue(options.enabled, !0)),
        (this._viewerPosition = Cesium.defaultValue(
          viewer.viewerPosition,
          new Cesium.Cartesian3.fromDegrees(0, 0, 0)
        )),
        (this._heading = Cesium.defaultValue(viewer.heading, 0)),
        (this._pitch = Cesium.defaultValue(viewer.pitch, 0)),
        (this._horizontalFov = Cesium.defaultValue(viewer.horizontalFov, 120)),
        (this._verticalFov = Cesium.defaultValue(viewer.verticalFov, 60)),
        (this._distance = Cesium.defaultValue(viewer.distance, 100)),
        (this._visibleAreaColor =
          viewer.visibleAreaColor instanceof Cesium.Color
            ? viewer.visibleAreaColor
            : Cesium.Color.fromCssColorString(viewer.visibleAreaColor)),
        (this._visibleAreaColorAlpha =
          null == viewer.visibleAreaColorAlpha
            ? 1
            : viewer.visibleAreaColorAlpha),
        (this._hiddenAreaColor =
          viewer.hiddenAreaColor instanceof Cesium.Color
            ? viewer.hiddenAreaColor
            : Cesium.Color.fromCssColorString(viewer.hiddenAreaColor)),
        (this._hiddenAreaColorAlpha =
          null == viewer.hiddenAreaColorAlpha
            ? 1
            : viewer.hiddenAreaColorAlpha),
        (this._size = Cesium.defaultValue(options.size, 2048)),
        (this._softShadows = Cesium.defaultValue(options.softShadows, !1)),
        (this._bugDistance =
          this._distance +
          1e-6 * this._horizontalFov -
          1e-6 * this._verticalFov),
        (this._outlineColor = Cesium.defaultValue(
          options.outlineColor,
          Cesium.Color.YELLOW
        )),
        (this._lightCameraPrimitive = void 0),
        (this._lightCamera = new Cesium.Camera(this._scene)),
        (this._lightCameraDirty = !1),
        (this._stage = void 0),
        (this._stageDirty = !0),
        this.updateCamera(),
        (this._shadowMap = new Cesium.ShadowMap({
          context: this._scene.context,
          lightCamera: this._lightCamera,
          enabled: this._enabled,
          isPointLight: !1,
          pointLightRadius: 100,
          cascadesEnabled: !1,
          size: this._size,
          softShadows: this._softShadows,
          normalOffset: !1,
          fromLightSource: !1,
        })),
        (this._bias = this._shadowMap._primitiveBias);
    }
    return (
      _createClass(VisualField, [
        {
          key: "enabled",
          get: function () {
            return this._enabled;
          },
          set: function (value) {
            (this._enabled = value), (this._shadowMap.enabled = value);
          },
        },
        {
          key: "softShadows",
          get: function () {
            return this._softShadows;
          },
          set: function (value) {
            (this._softShadows = value), (this._shadowMap.softShadows = value);
          },
        },
        {
          key: "size",
          get: function () {
            return this._size;
          },
          set: function (value) {
            (this.size = value), (this._shadowMap.size = value);
          },
        },
        {
          key: "visibleAreaColor",
          get: function () {
            return Cesium.Color.fromCartesian4(this._visibleAreaColor);
          },
          set: function (value) {
            value =
              value instanceof Cesium.Color
                ? value
                : Cesium.Color.fromCssColorString(value);
            (this._visibleAreaColor = value), this._scene.requestRender();
          },
        },
        {
          key: "visibleAreaColorAlpha",
          get: function () {
            return this._visibleAreaColorAlpha;
          },
          set: function (value) {
            (this._visibleAreaColorAlpha = Number(value)),
              this._scene.requestRender();
          },
        },
        {
          key: "hiddenAreaColorAlpha",
          get: function () {
            return this._hiddenAreaColorAlpha;
          },
          set: function (value) {
            (this._hiddenAreaColorAlpha = Number(value)),
              this._scene.requestRender();
          },
        },
        {
          key: "hiddenAreaColor",
          get: function () {
            return Cesium.Color.fromCartesian4(this._hiddenAreaColor);
          },
          set: function (value) {
            value =
              value instanceof Cesium.Color
                ? value
                : Cesium.Color.fromCssColorString(value);
            (this._hiddenAreaColor = value), this._scene.requestRender();
          },
        },
        {
          key: "viewerPosition",
          get: function () {
            return this._viewerPosition;
          },
          set: function (value) {
            (this._viewerPosition = value),
              (this._lightCameraDirty = !0),
              this._scene.requestRender();
          },
        },
        {
          key: "heading",
          get: function () {
            return this._heading;
          },
          set: function (value) {
            (this._heading = value),
              (this._lightCameraDirty = !0),
              this._scene.requestRender();
          },
        },
        {
          key: "pitch",
          get: function () {
            return this._pitch;
          },
          set: function (value) {
            (this._pitch = value),
              (this._lightCameraDirty = !0),
              this._scene.requestRender();
          },
        },
        {
          key: "horizontalFov",
          get: function () {
            return this._horizontalFov;
          },
          set: function (value) {
            (this._horizontalFov = value),
              (this._bugDistance =
                this._distance +
                1e-6 * this._horizontalFov -
                1e-6 * this._verticalFov),
              (this._lightCameraDirty = !0),
              this._scene.requestRender();
          },
        },
        {
          key: "verticalFov",
          get: function () {
            return this._verticalFov;
          },
          set: function (value) {
            (this._verticalFov = value),
              (this._bugDistance =
                this._distance +
                1e-6 * this._horizontalFov -
                1e-6 * this._verticalFov),
              (this._lightCameraDirty = !0),
              this._scene.requestRender();
          },
        },
        {
          key: "distance",
          get: function () {
            return this._distance;
          },
          set: function (value) {
            (this._distance = value),
              (this._bugDistance =
                this._distance +
                1e-6 * this._horizontalFov -
                1e-6 * this._verticalFov),
              (this._lightCameraDirty = !0),
              this._scene.requestRender();
          },
        },
        {
          key: "updateCamera",
          value: function () {
            (this._lightCamera.frustum.near = 0.001 * this._bugDistance),
              (this._lightCamera.frustum.far = this._bugDistance),
              (this._lightCamera.frustum.fov = Cesium.Math.toRadians(
                this._verticalFov
              ));
            var horizontalFovRadians = Cesium.Math.toRadians(
                this._horizontalFov
              ),
              verticalFovRadians = Cesium.Math.toRadians(this._verticalFov),
              horizontalFovRadians =
                ((this._lightCamera.frustum.aspectRatio =
                  (this._bugDistance *
                    Math.tan(0.5 * horizontalFovRadians) *
                    2) /
                  (this._bugDistance * Math.tan(0.5 * verticalFovRadians) * 2)),
                this._horizontalFov > this._verticalFov &&
                  (this._lightCamera.frustum.fov = Cesium.Math.toRadians(
                    this._horizontalFov
                  )),
                this._lightCamera.setView({
                  destination: this._viewerPosition,
                  orientation: {
                    heading: Cesium.Math.toRadians(this._heading),
                    pitch: Cesium.Math.toRadians(this._pitch),
                  },
                }),
                this._lightCameraPrimitive &&
                  (this._lightCameraPrimitive.destroy(),
                  (this._lightCameraPrimitive = void 0)),
                this.createOutLineGeometry());
            (this._lightCameraPrimitive = new Cesium.Primitive({
              geometryInstances: new Cesium.GeometryInstance({
                geometry: horizontalFovRadians,
                attributes: {
                  color: Cesium.ColorGeometryInstanceAttribute.fromColor(
                    this._outlineColor
                  ),
                },
              }),
              appearance: new Cesium.PerInstanceColorAppearance({
                translucent: !1,
                flat: !0,
              }),
              modelMatrix: this._lightCamera.inverseViewMatrix,
              asynchronous: !1,
            })),
              (this._lightCameraDirty = !1);
          },
        },
        {
          key: "createOutLineGeometry",
          value: function () {
            var positions = new Float32Array(633),
              p = positions,
              m = Cesium.Math.toRadians(this._horizontalFov),
              v = Cesium.Math.toRadians(this._verticalFov),
              b = Math.tan(0.5 * m),
              v = Math.tan(0.5 * v),
              b = this._distance * b,
              d = this._distance * v;
            (i = -b), (s = -d);
            for (
              var I,
                P = 0,
                M =
                  ((p[P++] = 0), (p[P++] = 0), (p[P++] = 0), Math.PI - 0.5 * m),
                R = m / 4,
                L = 0;
              L < 5;
              ++L
            )
              for (
                var D = M + L * R,
                  B = d / (this._distance / Math.cos(D)),
                  B = Math.atan(B),
                  U = -B,
                  V = B / 10,
                  z = 0;
                z < 21;
                ++z
              )
                (I = U + z * V),
                  (p[P++] = this._distance * Math.cos(I) * Math.sin(D)),
                  (p[P++] = this._distance * Math.sin(I)),
                  (p[P++] = this._distance * Math.cos(I) * Math.cos(D));
            for (var R = m / 20, G = 0; G < 21; ++G) {
              D = M + G * R;
              for (
                var _B = d / (this._distance / Math.cos(D)),
                  _B = Math.atan(_B),
                  _U = -_B,
                  _V = _B / 2,
                  H = 0;
                H < 5;
                ++H
              )
                (I = _U + H * _V),
                  (p[P++] = this._distance * Math.cos(I) * Math.sin(D)),
                  (p[P++] = this._distance * Math.sin(I)),
                  (p[P++] = this._distance * Math.cos(I) * Math.cos(D));
            }
            var v = new Cesium.GeometryAttributes({
                position: new Cesium.GeometryAttribute({
                  componentDatatype: Cesium.ComponentDatatype.DOUBLE,
                  componentsPerAttribute: 3,
                  values: positions,
                }),
              }),
              b = new Uint16Array(408),
              t = b,
              r = 0;
            (t[r++] = 0),
              (t[r++] = 1),
              (t[r++] = 0),
              (t[r++] = 21),
              (t[r++] = 0),
              (t[r++] = 85),
              (t[r++] = 0),
              (t[r++] = 105);
            for (var i = 0, n = 0; n < 5; ++n) {
              i++;
              for (var _a = 0; _a < 20; ++_a) (t[r++] = i++), (t[r++] = i);
            }
            i++;
            for (var s = 0; s < 20; ++s)
              for (var l = 0; l < 5; ++l) (t[r++] = i), (t[r++] = 5 + i++);
            return new Cesium.Geometry({
              attributes: v,
              indices: b,
              primitiveType: Cesium.PrimitiveType.LINES,
              boundingSphere: Cesium.BoundingSphere.fromVertices(positions),
            });
          },
        },
        {
          key: "updateStage",
          value: function () {
            var scratchTexelStepSize,
              bias,
              shadowMap,
              that,
              uniformMap,
              fshader;
            this._stageDirty &&
              ((this._stageDirty = !1),
              Cesium.defined(this._stage) &&
                (this._scene.postProcessStages.remove(this._stage),
                (this._stage = void 0)),
              (scratchTexelStepSize = new Cesium.Cartesian2()),
              (bias = this._bias),
              (shadowMap = this._shadowMap),
              (that = this),
              (uniformMap = {
                shadowMap_texture: function () {
                  return shadowMap._shadowMapTexture;
                },
                shadowMap_matrix: function () {
                  return shadowMap._shadowMapMatrix;
                },
                viewShed_frontColor: function () {
                  var vColor = that._visibleAreaColor.withAlpha(
                    that._visibleAreaColorAlpha
                  );
                  return Cesium.Cartesian4.fromColor(vColor);
                },
                viewShed_backColor: function () {
                  var hColor = that._hiddenAreaColor.withAlpha(
                    that._hiddenAreaColorAlpha
                  );
                  return Cesium.Cartesian4.fromColor(hColor);
                },
                viewShed_Far: function () {
                  return shadowMap._lightCamera.frustum.far;
                },
                shadowMap_lightheadingEC: function () {
                  return shadowMap._lightheadingEC;
                },
                shadowMap_lightPositionEC: function () {
                  return shadowMap._lightPositionEC;
                },
                shadowMap_texelSizeDepthBiasAndNormalShadingSmooth:
                  function () {
                    var texelStepSize = scratchTexelStepSize;
                    return (
                      (texelStepSize.x = 1 / shadowMap._textureSize.x),
                      (texelStepSize.y = 1 / shadowMap._textureSize.y),
                      Cesium.Cartesian4.fromElements(
                        texelStepSize.x,
                        texelStepSize.y,
                        bias.depthBias,
                        bias.normalShadingSmooth,
                        this.combinedUniforms1
                      )
                    );
                  },
                shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness:
                  function () {
                    return Cesium.Cartesian4.fromElements(
                      bias.normalOffsetScale,
                      shadowMap._distance,
                      shadowMap.maximumDistance,
                      shadowMap._darkness,
                      this.combinedUniforms2
                    );
                  },
                combinedUniforms1: new Cesium.Cartesian4(),
                combinedUniforms2: new Cesium.Cartesian4(),
              }),
              (fshader = getPostStageFragmentShader(shadowMap, !1)),
              (this._stage = new Cesium.PostProcessStage({
                fragmentShader: fshader,
                uniforms: uniformMap,
              })),
              this._scene.postProcessStages.add(this._stage));
          },
        },
        {
          key: "update",
          value: function (frameState) {
            this._lightCameraDirty && this.updateCamera(),
              this.updateStage(),
              frameState.shadowMaps.push(this._shadowMap),
              this._lightCameraPrimitive &&
                this._lightCameraPrimitive.update(frameState);
          },
        },
        {
          key: "destroy",
          value: function () {
            Cesium.defined(this._stage) &&
              (this._scene.postProcessStages.remove(this._stage),
              (this._stage = void 0)),
              (this._shadowMap = this._shadowMap.destroy()),
              this._lightCameraPrimitive &&
                (this._lightCameraPrimitive.destroy(),
                (this._lightCameraPrimitive = void 0));
          },
        },
      ]),
      VisualField
    );
  })(),
  visualFieldTool = (function () {
    function visualFieldTool(viewer, opt) {
      if ((_classCallCheck(this, visualFieldTool), !Cesium.defined(viewer)))
        throw new Cesium.DeveloperError("缺少地图对象！");
      (this.viewer = viewer),
        (this.handler = void 0),
        (this.prompt = null),
        (this.vfPrimitive = null),
        (this.vfPrimitiveArr = []);
    }
    return (
      _createClass(visualFieldTool, [
        {
          key: "on",
          value: function (type, fun) {
            "startEdit" == type
              ? (this.startEditFun = fun)
              : "endEdit" == type
              ? (this.endEditFun = fun)
              : "remove" == type
              ? (this.removeFun = fun)
              : "endCreate" == type && (this.endCreateFun = fun);
          },
        },
        {
          key: "startDraw",
          value: function (opt, fun) {
            var that = this,
              visibleAreaColor =
                (((opt = Object.assign(
                  {
                    visibleAreaColor: "#00FF00",
                    visibleAreaColorAlpha: 1,
                    hiddenAreaColor: "#FF0000",
                    hiddenAreaColorAlpha: 1,
                    verticalFov: 60,
                    horizontalFov: 120,
                  },
                  opt || {}
                )).id =
                  opt.id ||
                  Number(
                    new Date().getTime() +
                      "" +
                      Number(1e3 * Math.random()).toFixed(0)
                  )),
                opt.visibleAreaColor),
              hiddenAreaColor = opt.hiddenAreaColor,
              visibleAreaColorAlpha = opt.visibleAreaColorAlpha,
              hiddenAreaColorAlpha = opt.hiddenAreaColorAlpha,
              verticalFov = opt.verticalFov,
              horizontalFov = opt.horizontalFov,
              startPosition = void 0,
              endPosition = void 0,
              vfPrimitive = void 0;
            this.prompt ||
              (this.prompt = new Prompt$1(this.viewer, this.promptStyle)),
              this.handler ||
                (this.handler = new Cesium.ScreenSpaceEventHandler(
                  this.viewer.scene.canvas
                )),
              this.handler.setInputAction(function (evt) {
                var c1,
                  c2,
                  evt = that.getCatesian3FromPX(evt.position, that.viewer);
                evt &&
                  (startPosition
                    ? ((endPosition = evt.clone()),
                      that.handler &&
                        (that.handler.destroy(), (that.handler = null)),
                      that.prompt &&
                        (that.prompt.destroy(), (that.prompt = null)),
                      (c1 = Cesium.Cartographic.fromCartesian(
                        startPosition.clone()
                      )),
                      (c2 = Cesium.Cartographic.fromCartesian(
                        endPosition.clone()
                      )),
                      (c1 = that.computeAngle(c1, c2)),
                      (vfPrimitive.heading = c1),
                      (vfPrimitive.attr.heading = c1),
                      (c2 = Cesium.Cartesian3.distance(
                        startPosition.clone(),
                        endPosition.clone()
                      )),
                      (vfPrimitive.distance = c2),
                      (vfPrimitive.attr.distance = c2),
                      (endPosition = startPosition = void 0),
                      fun && fun(vfPrimitive))
                    : (startPosition = evt.clone()));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK),
              this.handler.setInputAction(function (evt) {
                var cartesian, c1, c2;
                startPosition
                  ? (that.prompt.update(evt.endPosition, "再次单击结束"),
                    (cartesian = that.getCatesian3FromPX(
                      evt.endPosition,
                      that.viewer
                    )) &&
                      (vfPrimitive ||
                        ((vfPrimitive = new VisualField(that.viewer, {
                          cameraOptions: {
                            viewerPosition: startPosition.clone(),
                            visibleAreaColor: visibleAreaColor,
                            visibleAreaColorAlpha: visibleAreaColorAlpha,
                            hiddenAreaColor: hiddenAreaColor,
                            hiddenAreaColorAlpha: hiddenAreaColorAlpha,
                            horizontalFov: horizontalFov,
                            verticalFov: verticalFov,
                          },
                        })),
                        that.viewer.scene.primitives.add(vfPrimitive),
                        that.vfPrimitiveArr.push(vfPrimitive),
                        (vfPrimitive.attr = opt)),
                      (c1 = Cesium.Cartographic.fromCartesian(
                        startPosition.clone()
                      )),
                      (c2 = Cesium.Cartographic.fromCartesian(
                        cartesian.clone()
                      )),
                      (c1 = that.computeAngle(c1, c2)),
                      (vfPrimitive.heading = c1),
                      (vfPrimitive.attr.heading = c1),
                      (c2 = Cesium.Cartesian3.distance(
                        startPosition.clone(),
                        cartesian.clone()
                      )),
                      (vfPrimitive.distance = c2),
                      (vfPrimitive.attr.distance = c2)))
                  : that.prompt.update(evt.endPosition, "单击开始绘制");
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "setVisibleAreaColor",
          value: function (vfPrimitive, val) {
            val &&
              ((this.visibleAreaColor = val),
              vfPrimitive && (vfPrimitive.visibleAreaColor = val));
          },
        },
        {
          key: "setVisibleAreaColorAlpha",
          value: function (vfPrimitive, val) {
            val &&
              ((this.visibleAreaColorAlpha = Number(val)),
              vfPrimitive && (vfPrimitive.visibleAreaColorAlpha = Number(val)));
          },
        },
        {
          key: "setHiddenAreaColor",
          value: function (vfPrimitive, val) {
            val &&
              ((this.hiddenAreaColor = val),
              vfPrimitive && (vfPrimitive.hiddenAreaColor = val));
          },
        },
        {
          key: "setHiddenAreaColorAlpha",
          value: function (vfPrimitive, val) {
            val &&
              ((this.hiddenAreaColorAlpha = Number(val)),
              vfPrimitive && (vfPrimitive.hiddenAreaColorAlpha = Number(val)));
          },
        },
        {
          key: "setDistance",
          value: function (vfPrimitive, val) {
            val &&
              ((this.distance = Number(val)),
              vfPrimitive && (vfPrimitive.distance = Number(val)));
          },
        },
        {
          key: "setVerticalFov",
          value: function (vfPrimitive, val) {
            val &&
              ((this.verticalFov = Number(val)),
              vfPrimitive && (vfPrimitive.verticalFov = Number(val)));
          },
        },
        {
          key: "setHorizontalFov",
          value: function (vfPrimitive, val) {
            val &&
              ((val = 180 <= (val = Number(val)) ? 179 : val),
              (this.horizontalFov = Number(val)),
              vfPrimitive && (vfPrimitive.horizontalFov = Number(val)));
          },
        },
        {
          key: "setHeading",
          value: function (vfPrimitive, val) {
            val &&
              ((this.heading = 0),
              vfPrimitive && (vfPrimitive.heading = Number(val)));
          },
        },
        {
          key: "setPitch",
          value: function (vfPrimitive, val) {
            val &&
              ((this.pitch = Number(val)),
              vfPrimitive && (vfPrimitive.pitch = Number(val)));
          },
        },
        {
          key: "computeAngle",
          value: function (p1, p2) {
            var lng_a, lng_b, y;
            if (p1 && p2)
              return (
                (lng_a = p1.longitude),
                (p1 = p1.latitude),
                (lng_b = p2.longitude),
                (p2 = p2.latitude),
                (y = Math.sin(lng_b - lng_a) * Math.cos(p2)),
                (p1 =
                  Math.cos(p1) * Math.sin(p2) -
                  Math.sin(p1) * Math.cos(p2) * Math.cos(lng_b - lng_a)),
                (p2 = (180 * (p2 = Math.atan2(y, p1))) / Math.PI) < -180 &&
                  (p2 += 360),
                p2 % 360
              );
          },
        },
        {
          key: "getCatesian3FromPX",
          value: function (px) {
            for (
              var cartesian,
                picks = this.viewer.scene.drillPick(px),
                isOn3dtiles = (this.viewer.scene.render(), !1),
                i = 0;
              i < picks.length;
              i++
            )
              if (
                picks[i] &&
                picks[i].primitive &&
                picks[i].primitive instanceof Cesium.Cesium3DTileset
              ) {
                isOn3dtiles = !0;
                break;
              }
            if (isOn3dtiles) cartesian = this.viewer.scene.pickPosition(px);
            else {
              px = this.viewer.camera.getPickRay(px);
              if (!px) return null;
              cartesian = this.viewer.scene.globe.pick(px, this.viewer.scene);
            }
            return cartesian;
          },
        },
        {
          key: "clear",
          value: function () {
            for (var i = 0; i < this.vfPrimitiveArr.length; i++) {
              var vfPrimitive = this.vfPrimitiveArr[i];
              this.viewer.scene.primitives.remove(vfPrimitive), 0;
            }
            this.vfPrimitiveArr = [];
          },
        },
        {
          key: "removeAll",
          value: function () {
            for (var i = 0; i < this.vfPrimitiveArr.length; i++) {
              var vfPrimitive = this.vfPrimitiveArr[i];
              this.viewer.scene.primitives.remove(vfPrimitive), 0;
            }
            this.vfPrimitiveArr = [];
          },
        },
        {
          key: "destroy",
          value: function () {
            this.clear(),
              this.handler && (this.handler.destroy(), (this.handler = null)),
              this.prompt && (this.prompt.destroy(), (this.prompt = null));
          },
        },
        {
          key: "getVfPrimitiveByField",
          value: function (fieldName, fieldVlue) {
            return (
              (fieldName = fieldName || "id"),
              this.vfPrimitiveArr.filter(function (item) {
                return (item.attr[fieldName] = fieldVlue);
              })
            );
          },
        },
        {
          key: "getVfPrimitiveById",
          value: function (id) {
            for (var vpObj = {}, i = 0; i < this.vfPrimitiveArr.length; i++) {
              var vp = this.vfPrimitiveArr[i];
              if (vp.attr.id == id) {
                (vpObj.vfPrimitive = vp), (vpObj.index = i);
                break;
              }
            }
            return vpObj;
          },
        },
        {
          key: "removeVfPrimitiveById",
          value: function (id) {
            id &&
              ((id = this.getVfPrimitiveById(id)).vfPrimitive &&
                this.viewer.scene.primitives.remove(id.vfPrimitive),
              this.vfPrimitiveArr.splice(id.index, 1));
          },
        },
        {
          key: "removeOne",
          value: function (vfPrimitive) {
            vfPrimitive && this.removeVfPrimitiveById(vfPrimitive.attr.id);
          },
        },
      ]),
      visualFieldTool
    );
  })(),
  GaodePOI = (function () {
    function GaodePOI(opt) {
      _classCallCheck(this, GaodePOI), (this.opt = opt || {});
      opt = ["a73e387f642573295b498d7fd6b4c537"];
      (this._key = void 0),
        this.opt.keys && 0 != this.opt.keys.length
          ? this.opt.keys instanceof Array
            ? (this._key =
                this.opt.keys[Math.floor(Math.random() * this.opt.keys.length)])
            : (this._key = this.opt.keys)
          : (this._key = opt[Math.floor(Math.random() * opt.length)]);
    }
    return (
      _createClass(GaodePOI, [
        {
          key: "key",
          get: function () {
            return this._key;
          },
          set: function (key) {
            this._key = key;
          },
        },
        {
          key: "queryText",
          value: function (options, success) {
            var params = {
                key: this._key,
                offset: options.pageSize || 25,
                page: options.pageNumber || 1,
              },
              params = Object.assign(params, options || {}),
              that = this;
            axios
              .get("https://restapi.amap.com/v3/place/text", { params: params })
              .then(function (res) {
                for (
                  var pois = res.data.pois || [], i = 0;
                  i < pois.length;
                  i++
                ) {
                  var poi = pois[i],
                    location = (location = poi.location).split(","),
                    location = that.gcj2wgs(location);
                  poi.lnglat = location;
                }
                success && success(res.data.pois);
              });
          },
        },
        {
          key: "queryAround",
          value: function (options, success) {
            var location, that;
            options && options.center
              ? ((location = this.wgs2gcj(options.center)),
                (location = {
                  key: this._key,
                  location: location[0] + "," + location[1],
                  offset: options.pageSize || 25,
                  page: options.pageNumber || 1,
                  radius: options.radius,
                }),
                (that = this),
                axios
                  .get("https://restapi.amap.com/v3/place/around", {
                    params: location,
                  })
                  .then(function (res) {
                    for (
                      var pois = res.data.pois || [], i = 0;
                      i < pois.length;
                      i++
                    ) {
                      var poi = pois[i],
                        _location = (_location = poi.location).split(","),
                        _location = that.gcj2wgs(_location);
                      poi.lnglat = _location;
                    }
                    success && success(res.data.pois);
                  }))
              : alert("缺少搜索中心点！");
          },
        },
        {
          key: "queryPolygon",
          value: function (options, success) {
            if (!options || !options.lnglats || options.lnglats.length < 3)
              alert("缺少搜索范围！");
            else {
              for (var polygon = "", i = 0; i < options.lnglats.length; i++) {
                var lnglat = options.lnglats[i];
                polygon +=
                  (lnglat = this.wgs2gcj(lnglat))[0] + "," + lnglat[1] + "|";
              }
              var firstlnglat = this.wgs2gcj(options.lnglats[0]),
                firstlnglat =
                  ((polygon += firstlnglat[0] + "," + firstlnglat[1]),
                  {
                    key: this._key,
                    polygon: polygon,
                    offset: options.pageSize || 25,
                    page: options.pageNumber || 1,
                  }),
                that = this;
              axios
                .get("https://restapi.amap.com/v3/place/polygon", {
                  params: firstlnglat,
                })
                .then(function (res) {
                  for (
                    var pois = res.data.pois || [], _i = 0;
                    _i < pois.length;
                    _i++
                  ) {
                    var poi = pois[_i],
                      location = (location = poi.location).split(","),
                      location = that.gcj2wgs(location);
                    poi.lnglat = location;
                  }
                  success && success(res.data.pois);
                });
            }
          },
        },
        {
          key: "query",
          value: function (type, params, success) {
            1 == (type = Number(type || 1))
              ? this.queryText(params, success)
              : 2 == type
              ? this.queryAround(params, success)
              : 3 == type
              ? this.queryPolygon(params, success)
              : alert("poi查询类型有误");
          },
        },
        {
          key: "transformWD",
          value: function (lng, lat) {
            var PI = 3.141592653589793,
              ret =
                2 * lng -
                100 +
                3 * lat +
                0.2 * lat * lat +
                0.1 * lng * lat +
                0.2 * Math.sqrt(Math.abs(lng));
            return (
              (ret +=
                (2 *
                  (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI))) /
                3) +
              (2 * (20 * Math.sin(lat * PI) + 40 * Math.sin((lat / 3) * PI))) /
                3 +
              (2 *
                (160 * Math.sin((lat / 12) * PI) +
                  320 * Math.sin((lat * PI) / 30))) /
                3
            );
          },
        },
        {
          key: "transformJD",
          value: function (lng, lat) {
            var PI = 3.141592653589793,
              lat =
                300 +
                lng +
                2 * lat +
                0.1 * lng * lng +
                0.1 * lng * lat +
                0.1 * Math.sqrt(Math.abs(lng));
            return (
              (lat +=
                (2 *
                  (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI))) /
                3) +
              (2 * (20 * Math.sin(lng * PI) + 40 * Math.sin((lng / 3) * PI))) /
                3 +
              (2 *
                (150 * Math.sin((lng / 12) * PI) +
                  300 * Math.sin((lng / 30) * PI))) /
                3
            );
          },
        },
        {
          key: "wgs2gcj",
          value: function (arrdata) {
            var a = 6378245,
              ee = 0.006693421622965943,
              PI = 3.141592653589793,
              lng = Number(arrdata[0]),
              arrdata = Number(arrdata[1]),
              dlat = this.transformWD(lng - 105, arrdata - 35),
              dlng = this.transformJD(lng - 105, arrdata - 35),
              radlat = (arrdata / 180) * PI,
              magic = 1 - ee * (magic = Math.sin(radlat)) * magic,
              sqrtmagic = Math.sqrt(magic),
              arrdata =
                arrdata +
                (180 * dlat) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI),
              dlat =
                lng + (180 * dlng) / ((a / sqrtmagic) * Math.cos(radlat) * PI);
            return [
              (dlat = Number(dlat.toFixed(6))),
              (arrdata = Number(arrdata.toFixed(6))),
            ];
          },
        },
        {
          key: "gcj2wgs",
          value: function (arrdata) {
            var a = 6378245,
              ee = 0.006693421622965943,
              PI = 3.141592653589793,
              lng = Number(arrdata[0]),
              arrdata = Number(arrdata[1]),
              dlat = this.transformWD(lng - 105, arrdata - 35),
              dlng = this.transformJD(lng - 105, arrdata - 35),
              radlat = (arrdata / 180) * PI,
              magic = 1 - ee * (magic = Math.sin(radlat)) * magic,
              sqrtmagic = Math.sqrt(magic),
              dlat =
                (180 * dlat) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI),
              ee =
                2 * lng -
                (lng +
                  (180 * dlng) / ((a / sqrtmagic) * Math.cos(radlat) * PI)),
              magic = 2 * arrdata - (arrdata + dlat);
            return [
              (ee = Number(ee.toFixed(6))),
              (magic = Number(magic.toFixed(6))),
            ];
          },
        },
      ]),
      GaodePOI
    );
  })(),
  GaodeRoute = (function () {
    function GaodeRoute(opt) {
      _classCallCheck(this, GaodeRoute), (this.opt = opt || {});
      opt = ["a73e387f642573295b498d7fd6b4c537"];
      (this._key = void 0),
        this.opt.keys && 0 != this.opt.keys.length
          ? this.opt.keys instanceof Array
            ? (this._key =
                this.opt.keys[Math.floor(Math.random() * this.opt.keys.length)])
            : (this._key = this.opt.keys)
          : (this._key = opt[Math.floor(Math.random() * opt.length)]);
    }
    return (
      _createClass(GaodeRoute, [
        {
          key: "key",
          get: function () {
            return this._key;
          },
          set: function (key) {
            this._key = key;
          },
        },
        {
          key: "queryDriving",
          value: function (options, success, error) {
            if ((options = options || {}).origin)
              if (options.destination) {
                var origin = options.origin,
                  gcj_origin =
                    (gcj_origin = this.wgs2gcj(origin))[0] +
                    "," +
                    gcj_origin[1],
                  destination = (delete options.origin, options.destination),
                  gcj_destination =
                    (gcj_destination = this.wgs2gcj(destination))[0] +
                    "," +
                    gcj_destination[1],
                  avoidpolygons = (delete options.destination, "");
                if (options.avoidpolygons)
                  for (var i = 0; i < options.avoidpolygons.length; i++) {
                    for (
                      var avoidpolygon = options.avoidpolygons[i],
                        firstLnglat = "",
                        polygonstr = "",
                        j = 0;
                      j < avoidpolygon.length;
                      j++
                    ) {
                      var lnglat = avoidpolygon[j];
                      (polygonstr +=
                        (lnglat = this.wgs2gcj(lnglat))[0] +
                        "," +
                        lnglat[1] +
                        ","),
                        0 == j && (firstLnglat = lnglat[0] + "," + lnglat[1]);
                    }
                    (polygonstr += firstLnglat),
                      i == options.avoidpolygons.length - 1
                        ? (avoidpolygons += polygonstr)
                        : (avoidpolygons += polygonstr + "|");
                  }
                delete options.avoidpolygons;
                var gcj_origin = {
                    key: this._key,
                    origin: gcj_origin,
                    destination: gcj_destination,
                    strategy: 0,
                    avoidpolygons: avoidpolygons,
                    show_fields: "polyline",
                  },
                  gcj_origin = Object.assign(gcj_origin, options || {}),
                  that = this;
                axios
                  .get("https://restapi.amap.com/v5/direction/driving", {
                    params: gcj_origin,
                  })
                  .then(function (res) {
                    200 != res.status || "10000" != res.data.infocode
                      ? (console.log("查询失败！"), error && error(res.data))
                      : ((res = that.transformData(
                          origin,
                          destination,
                          res.data.route
                        )),
                        success && success(res));
                  });
              } else alert("缺少终点坐标！");
            else alert("缺少起点坐标！");
          },
        },
        {
          key: "queryUndriving",
          value: function (url, options, success, error) {
            var origin, destination, gcj_destination, gcj_origin, that;
            (options = options || {}).origin
              ? options.destination
                ? ((origin = options.origin),
                  (gcj_origin = this.wgs2gcj(origin)),
                  (gcj_origin = origin[0] + "," + origin[1]),
                  delete options.origin,
                  (destination = options.destination),
                  (gcj_destination = this.wgs2gcj(destination)),
                  (gcj_destination = destination[0] + "," + destination[1]),
                  delete options.destination,
                  (gcj_origin = {
                    key: this._key,
                    origin: gcj_origin,
                    destination: gcj_destination,
                    show_fields: "polyline",
                  }),
                  (gcj_origin = Object.assign(gcj_origin, options || {})),
                  (that = this),
                  axios.get(url, { params: gcj_origin }).then(function (res) {
                    200 != res.status
                      ? (console.log("查询失败！"), error && error(res.data))
                      : ((res = that.transformData(
                          origin,
                          destination,
                          res.data.data || res.data.route
                        )),
                        success && success(res));
                  }))
                : alert("缺少终点坐标！")
              : alert("缺少起点坐标！");
          },
        },
        {
          key: "query",
          value: function (type, params, success, error) {
            1 == (type = Number(type || 1))
              ? this.queryDriving(params, success, error)
              : 2 == type
              ? this.queryUndriving(
                  "https://restapi.amap.com/v4/direction/bicycling",
                  params,
                  success,
                  error
                )
              : 3 == type
              ? this.queryUndriving(
                  "https://restapi.amap.com/v3/direction/walking",
                  params,
                  success,
                  error
                )
              : alert("路径查询类型有误");
          },
        },
        {
          key: "transformWD",
          value: function (lng, lat) {
            var PI = 3.141592653589793,
              ret =
                2 * lng -
                100 +
                3 * lat +
                0.2 * lat * lat +
                0.1 * lng * lat +
                0.2 * Math.sqrt(Math.abs(lng));
            return (
              (ret +=
                (2 *
                  (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI))) /
                3) +
              (2 * (20 * Math.sin(lat * PI) + 40 * Math.sin((lat / 3) * PI))) /
                3 +
              (2 *
                (160 * Math.sin((lat / 12) * PI) +
                  320 * Math.sin((lat * PI) / 30))) /
                3
            );
          },
        },
        {
          key: "transformJD",
          value: function (lng, lat) {
            var PI = 3.141592653589793,
              lat =
                300 +
                lng +
                2 * lat +
                0.1 * lng * lng +
                0.1 * lng * lat +
                0.1 * Math.sqrt(Math.abs(lng));
            return (
              (lat +=
                (2 *
                  (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI))) /
                3) +
              (2 * (20 * Math.sin(lng * PI) + 40 * Math.sin((lng / 3) * PI))) /
                3 +
              (2 *
                (150 * Math.sin((lng / 12) * PI) +
                  300 * Math.sin((lng / 30) * PI))) /
                3
            );
          },
        },
        {
          key: "wgs2gcj",
          value: function (arrdata) {
            var a = 6378245,
              ee = 0.006693421622965943,
              PI = 3.141592653589793,
              lng = Number(arrdata[0]),
              arrdata = Number(arrdata[1]),
              dlat = this.transformWD(lng - 105, arrdata - 35),
              dlng = this.transformJD(lng - 105, arrdata - 35),
              radlat = (arrdata / 180) * PI,
              magic = 1 - ee * (magic = Math.sin(radlat)) * magic,
              sqrtmagic = Math.sqrt(magic),
              arrdata =
                arrdata +
                (180 * dlat) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI),
              dlat =
                lng + (180 * dlng) / ((a / sqrtmagic) * Math.cos(radlat) * PI);
            return [
              (dlat = Number(dlat.toFixed(6))),
              (arrdata = Number(arrdata.toFixed(6))),
            ];
          },
        },
        {
          key: "gcj2wgs",
          value: function (arrdata) {
            var a = 6378245,
              ee = 0.006693421622965943,
              PI = 3.141592653589793,
              lng = Number(arrdata[0]),
              arrdata = Number(arrdata[1]),
              dlat = this.transformWD(lng - 105, arrdata - 35),
              dlng = this.transformJD(lng - 105, arrdata - 35),
              radlat = (arrdata / 180) * PI,
              magic = 1 - ee * (magic = Math.sin(radlat)) * magic,
              sqrtmagic = Math.sqrt(magic),
              dlat =
                (180 * dlat) / (((a * (1 - ee)) / (magic * sqrtmagic)) * PI),
              ee =
                2 * lng -
                (lng +
                  (180 * dlng) / ((a / sqrtmagic) * Math.cos(radlat) * PI)),
              magic = 2 * arrdata - (arrdata + dlat);
            return [
              (ee = Number(ee.toFixed(6))),
              (magic = Number(magic.toFixed(6))),
            ];
          },
        },
        {
          key: "transformData",
          value: function (start, end, route) {
            for (
              var _this = this, paths = route.paths, allroute = [], i = 0;
              i < paths.length;
              i++
            )
              !(function (i) {
                for (
                  var path = paths[i],
                    lnglats = [],
                    instructions = [],
                    i = path.distance,
                    j = 0;
                  j < path.steps.length;
                  j++
                ) {
                  var item = path.steps[j],
                    instruction = path.steps[j].instruction;
                  item.polyline.split(";").forEach(function (element) {
                    (element = element.split(",")),
                      (element = _this.gcj2wgs(element)),
                      lnglats.push([element[0], element[1]]);
                  }),
                    instructions.push(instruction);
                }
                lnglats.unshift(start),
                  lnglats.push(end),
                  allroute.push({
                    lnglats: lnglats,
                    instructions: instructions,
                    distance: i,
                  });
              })(i);
            return allroute;
          },
        },
      ]),
      GaodeRoute
    );
  })();
function CompositeCoordinateSystem(api) {
  (this.dimensions = ["lng", "lat"]),
    (this._mapOffset = [0, 0]),
    (this._api = api);
}
function registerGLMap(viewer) {
  (CompositeCoordinateSystem.prototype.GLMap = viewer.scene),
    registerCoordinateSystem("GLMap", CompositeCoordinateSystem),
    registerAction(
      { type: "GLMapRoam", event: "GLMapRoam", update: "updateLayout" },
      function (payload, ecModel) {}
    ),
    extendComponentModel({
      type: "GLMap",
      getBMap: function () {
        return this._GLMap;
      },
      defaultOption: { roam: !1 },
    }),
    extendComponentView({
      type: "GLMap",
      lastCenter: null,
      lastCameraPitch: null,
      isControl: !0,
      init: function (ecModel, api) {
        var that = this,
          handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
        viewer.scene.postRender.addEventListener(function () {
          var cameraPosition = viewer.camera.position;
          cameraPosition
            ? (450 < Cesium.Cartographic.fromCartesian(cameraPosition).height &&
                (that.isControl = !0),
              that.isControl && api.dispatchAction({ type: "GLMapRoam" }))
            : (that.isControl = !0);
        }),
          handler.setInputAction(function (evt) {
            var cameraPosition = viewer.camera.position;
            cameraPosition
              ? Cesium.Cartographic.fromCartesian(cameraPosition).height <
                  450 && (that.isControl = !1)
              : (that.isControl = !0);
          }, Cesium.ScreenSpaceEventType.MIDDLE_DOWN),
          handler.setInputAction(function (evt) {
            that.isControl = !0;
          }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
      },
      render: function (GLMapModel, ecModel, api) {},
      dispose: function (target) {
        viewer.scene.postRender.removeEventListener(this.moveHandler, this);
      },
      getCenter: function (viewer) {
        var canvas = viewer.scene.canvas,
          canvas = new Cesium.Cartesian2(
            canvas.clientWidth / 2,
            canvas.clientHeight / 2
          ),
          canvas = viewer.scene.camera.getPickRay(canvas);
        return viewer.scene.globe.pick(
          canvas,
          viewer.scene,
          new Cesium.Cartesian3()
        );
      },
    });
}
function echartMap(viewer, option) {
  var chartContainer = document.createElement("div"),
    scene = viewer.scene;
  scene.canvas.setAttribute("tabIndex", 0),
    (chartContainer.style.position = "absolute"),
    (chartContainer.style.top = "0px"),
    (chartContainer.style.left = "0px"),
    (chartContainer.style.width = scene.canvas.width + "px"),
    (chartContainer.style.height = scene.canvas.height + "px"),
    (chartContainer.style.pointerEvents = "none"),
    chartContainer.setAttribute("id", "echarts_div"),
    chartContainer.setAttribute("class", "echartsLayer"),
    viewer.container.appendChild(chartContainer),
    registerGLMap(viewer),
    init(chartContainer).setOption(option);
}
(CompositeCoordinateSystem.dimensions =
  CompositeCoordinateSystem.prototype.dimensions =
    ["lng", "lat"]),
  (CompositeCoordinateSystem.prototype.setMapOffset = function (mapOffset) {
    this._mapOffset = mapOffset;
  }),
  (CompositeCoordinateSystem.prototype.getBMap = function () {
    return this.GLMap;
  }),
  (CompositeCoordinateSystem.prototype.dataToPoint = function (data) {
    var defVal = [99999, 99999],
      data = Cesium.Cartesian3.fromDegrees(data[0], data[1]);
    if (!data) return defVal;
    var px = Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.GLMap, data);
    if (!px) return defVal;
    defVal = this.GLMap;
    if (
      defVal.mode === Cesium.SceneMode.SCENE3D &&
      Cesium.Cartesian3.angleBetween(defVal.camera.position, data) >
        Cesium.Math.toRadians(80)
    )
      return [-100, -100];
    return [px.x - this._mapOffset[0], px.y - this._mapOffset[1]];
  }),
  (CompositeCoordinateSystem.prototype.pointToData = function (pt) {
    var mapOffset = this._mapOffset;
    return [
      (pt = this._bmap.project([pt[0] + mapOffset[0], pt[1] + mapOffset[1]]))
        .lng,
      pt.lat,
    ];
  }),
  (CompositeCoordinateSystem.prototype.getViewRect = function () {
    var api = this._api;
    return new graphic$1.BoundingRect(0, 0, api.getWidth(), api.getHeight());
  }),
  (CompositeCoordinateSystem.prototype.getRoamTransform = function () {
    return matrix.create();
  }),
  (CompositeCoordinateSystem.create = function (ecModel, api) {
    var coordSys,
      GLMap = CompositeCoordinateSystem.prototype.GLMap;
    ecModel.eachComponent("GLMap", function (GLMapModel) {
      (coordSys = new CompositeCoordinateSystem(GLMap, api)).setMapOffset(
        GLMapModel.__mapOffset || [0, 0]
      ),
        (GLMapModel.coordinateSystem = coordSys);
    }),
      ecModel.eachSeries(function (seriesModel) {
        "GLMap" === seriesModel.get("coordinateSystem") &&
          ((coordSys = new CompositeCoordinateSystem(GLMap, api)),
          (seriesModel.coordinateSystem = new CompositeCoordinateSystem(
            GLMap,
            api
          )));
      });
  });
var baiduMapLayer = mapv$1 ? baiduMapLayer$1 : null,
  BaseLayer$1 = baiduMapLayer ? baiduMapLayer.__proto__ : Function,
  backAngle = Cesium.Math.toRadians(75),
  MapVRenderer = (function () {
    _inherits(MapVRenderer, BaseLayer$1);
    var _super = _createSuper(MapVRenderer);
    function MapVRenderer(t, e, i, n) {
      var _this;
      return (
        _classCallCheck(this, MapVRenderer),
        (_this = _super.call(this, t, e, i)),
        BaseLayer$1 &&
          ((_this.map = t),
          (_this.scene = t.scene),
          (_this.dataSet = e),
          _this.init((i = i || {})),
          _this.argCheck(i),
          _this.initDevicePixelRatio(),
          (_this.canvasLayer = n),
          (_this.stopAniamation = !1),
          (_this.animation = i.animation),
          (_this.clickEvent = _this.clickEvent.bind(
            _assertThisInitialized(_this)
          )),
          (_this.mousemoveEvent = _this.mousemoveEvent.bind(
            _assertThisInitialized(_this)
          )),
          _this.bindEvent()),
        _possibleConstructorReturn(_this)
      );
    }
    return (
      _createClass(MapVRenderer, [
        {
          key: "initDevicePixelRatio",
          value: function () {
            this.devicePixelRatio = window.devicePixelRatio || 1;
          },
        },
        {
          key: "clickEvent",
          value: function (t) {
            var e = t.point;
            _get(
              _getPrototypeOf(MapVRenderer.prototype),
              "clickEvent",
              this
            ).call(this, e, t);
          },
        },
        {
          key: "mousemoveEvent",
          value: function (t) {
            var e = t.point;
            _get(
              _getPrototypeOf(MapVRenderer.prototype),
              "mousemoveEvent",
              this
            ).call(this, e, t);
          },
        },
        { key: "addAnimatorEvent", value: function () {} },
        {
          key: "animatorMovestartEvent",
          value: function () {
            var t = this.options.animation;
            this.isEnabledTime() &&
              this.animator &&
              (this.steps.step = t.stepsRange.start);
          },
        },
        {
          key: "animatorMoveendEvent",
          value: function () {
            this.isEnabledTime() && this.animator;
          },
        },
        {
          key: "bindEvent",
          value: function () {
            this.map,
              this.options.methods &&
                (this.options.methods.click, this.options.methods.mousemove);
          },
        },
        {
          key: "unbindEvent",
          value: function () {
            var t = this.map;
            this.options.methods &&
              (this.options.methods.click && t.off("click", this.clickEvent),
              this.options.methods.mousemove &&
                t.off("mousemove", this.mousemoveEvent));
          },
        },
        {
          key: "getContext",
          value: function () {
            return this.canvasLayer.canvas.getContext(this.context);
          },
        },
        {
          key: "init",
          value: function (t) {
            (this.options = t),
              this.initDataRange(t),
              (this.context = this.options.context || "2d"),
              this.options.zIndex &&
                this.canvasLayer &&
                this.canvasLayer.setZIndex(this.options.zIndex),
              this.initAnimator();
          },
        },
        {
          key: "_canvasUpdate",
          value: function (t) {
            this.map;
            var e = this.scene;
            if (this.canvasLayer && !this.stopAniamation) {
              var i = this.options.animation,
                n = this.getContext();
              if (this.isEnabledTime()) {
                if (void 0 === t) return void this.clear(n);
                "2d" === this.context &&
                  (n.save(),
                  (n.globalCompositeOperation = "destination-out"),
                  (n.fillStyle = "rgba(0, 0, 0, .1)"),
                  n.fillRect(0, 0, n.canvas.width, n.canvas.height),
                  n.restore());
              } else this.clear(n);
              if ("2d" === this.context)
                for (var o in this.options) n[o] = this.options[o];
              else n.clear(n.COLOR_BUFFER_BIT);
              var a = {
                  transferCoordinate: function (t) {
                    var px,
                      defVal = [99999, 99999],
                      t = Cesium.Cartesian3.fromDegrees(t[0], t[1]);
                    return t && (px = e.cartesianToCanvasCoordinates(t))
                      ? ((t = Cesium.Cartesian3.angleBetween(
                          e.camera.position,
                          t
                        )),
                        !(backAngle < t) && [px.x, px.y])
                      : defVal;
                  },
                },
                a =
                  (void 0 !== t &&
                    (a.filter = function (e) {
                      var n = i.trails || 10;
                      return !!(t && e.time > t - n && e.time < t);
                    }),
                  this.dataSet.get(a)),
                h =
                  (this.processData(a),
                  "m" == this.options.unit && this.options.size,
                  (this.options._size = this.options.size),
                  Cesium.SceneTransforms.wgs84ToWindowCoordinates(
                    e,
                    Cesium.Cartesian3.fromDegrees(0, 0)
                  ));
              this.drawContext(n, new DataSet(a), this.options, h),
                this.options.updateCallback && this.options.updateCallback(t);
            }
          },
        },
        {
          key: "updateData",
          value: function (t, e) {
            null != (t = t && t.get ? t.get() : t) && this.dataSet.set(t),
              _get(
                _getPrototypeOf(MapVRenderer.prototype),
                "update",
                this
              ).call(this, { options: e });
          },
        },
        {
          key: "addData",
          value: function (t, e) {
            var i = t;
            t && t.get && (i = t.get()),
              this.dataSet.add(i),
              this.update({ options: e });
          },
        },
        {
          key: "getData",
          value: function () {
            return this.dataSet;
          },
        },
        {
          key: "removeData",
          value: function (t) {
            var e;
            this.dataSet &&
              ((e = this.dataSet.get({
                filter: function (e) {
                  return null == t || "function" != typeof t || !t(e);
                },
              })),
              this.dataSet.set(e),
              this.update({ options: null }));
          },
        },
        {
          key: "clearData",
          value: function () {
            this.dataSet && this.dataSet.clear(),
              this.update({ options: null });
          },
        },
        {
          key: "draw",
          value: function () {
            this.canvasLayer.draw();
          },
        },
        {
          key: "clear",
          value: function (t) {
            t &&
              t.clearRect &&
              t.clearRect(0, 0, t.canvas.width, t.canvas.height);
          },
        },
      ]),
      MapVRenderer
    );
  })(),
  h = 0,
  MapvLayer = (function () {
    function MapvLayer(t, e, i, n) {
      _classCallCheck(this, MapvLayer),
        (this.map = t),
        (this.scene = t.scene),
        (this.mapvBaseLayer = new MapVRenderer(t, e, i, this)),
        (this.mapVOptions = i),
        this.initDevicePixelRatio(),
        (this.canvas = this._createCanvas()),
        (this.render = this.render.bind(this)),
        null != n
          ? (this.container = n).appendChild(this.canvas)
          : ((this.container = t.container), this.addInnerContainer()),
        this.bindEvent(),
        this._reset();
    }
    return (
      _createClass(MapvLayer, [
        {
          key: "initDevicePixelRatio",
          value: function () {
            this.devicePixelRatio = window.devicePixelRatio || 1;
          },
        },
        {
          key: "addInnerContainer",
          value: function () {
            this.container.appendChild(this.canvas);
          },
        },
        {
          key: "bindEvent",
          value: function () {
            (this.innerMoveStart = this.moveStartEvent.bind(this)),
              (this.innerMoveEnd = this.moveEndEvent.bind(this)),
              this.scene.camera.moveStart.addEventListener(
                this.innerMoveStart,
                this
              ),
              this.scene.camera.moveEnd.addEventListener(
                this.innerMoveEnd,
                this
              );
          },
        },
        {
          key: "unbindEvent",
          value: function () {
            this.scene.camera.moveStart.removeEventListener(
              this.innerMoveStart,
              this
            ),
              this.scene.camera.moveEnd.removeEventListener(
                this.innerMoveEnd,
                this
              ),
              this.scene.postRender.removeEventListener(this._reset, this);
          },
        },
        {
          key: "moveStartEvent",
          value: function () {
            this.mapvBaseLayer && this.mapvBaseLayer.animatorMovestartEvent(),
              this.scene.postRender.addEventListener(this._reset, this);
          },
        },
        {
          key: "moveEndEvent",
          value: function () {
            this.mapvBaseLayer && this.mapvBaseLayer.animatorMoveendEvent(),
              this._reset(),
              this.scene.postRender.removeEventListener(this._reset, this);
          },
        },
        {
          key: "zoomStartEvent",
          value: function () {
            this._unvisiable();
          },
        },
        {
          key: "zoomEndEvent",
          value: function () {
            this._unvisiable();
          },
        },
        {
          key: "addData",
          value: function (t, e) {
            null != this.mapvBaseLayer && this.mapvBaseLayer.addData(t, e);
          },
        },
        {
          key: "updateData",
          value: function (t, e) {
            null != this.mapvBaseLayer && this.mapvBaseLayer.updateData(t, e);
          },
        },
        {
          key: "getData",
          value: function () {
            return (
              this.mapvBaseLayer &&
                (this.dataSet = this.mapvBaseLayer.getData()),
              this.dataSet
            );
          },
        },
        {
          key: "removeData",
          value: function (t) {
            null != this.mapvBaseLayer &&
              this.mapvBaseLayer &&
              this.mapvBaseLayer.removeData(t);
          },
        },
        {
          key: "removeAllData",
          value: function () {
            null != this.mapvBaseLayer && this.mapvBaseLayer.clearData();
          },
        },
        {
          key: "_visiable",
          value: function () {
            return (this.canvas.style.display = "block");
          },
        },
        {
          key: "_unvisiable",
          value: function () {
            return (this.canvas.style.display = "none");
          },
        },
        {
          key: "_createCanvas",
          value: function () {
            var t = document.createElement("canvas"),
              e =
                ((t.id = this.mapVOptions.layerid || "mapv" + h++),
                (t.style.position = "absolute"),
                (t.style.top = "0px"),
                (t.style.left = "0px"),
                (t.style.pointerEvents = "none"),
                (t.style.zIndex = this.mapVOptions.zIndex || 100),
                (t.width = parseInt(this.map.canvas.width)),
                (t.height = parseInt(this.map.canvas.height)),
                (t.style.width = this.map.canvas.style.width),
                (t.style.height = this.map.canvas.style.height),
                this.devicePixelRatio);
            return (
              "2d" == this.mapVOptions.context &&
                t.getContext(this.mapVOptions.context).scale(e, e),
              t
            );
          },
        },
        {
          key: "_reset",
          value: function () {
            this.resizeCanvas(),
              this.fixPosition(),
              this.onResize(),
              this.render();
          },
        },
        {
          key: "draw",
          value: function () {
            this._reset();
          },
        },
        {
          key: "show",
          value: function () {
            this._visiable();
          },
        },
        {
          key: "hide",
          value: function () {
            this._unvisiable();
          },
        },
        {
          key: "destroy",
          value: function () {
            this.remove();
          },
        },
        {
          key: "remove",
          value: function () {
            null != this.mapvBaseLayer &&
              (this.removeAllData(),
              this.mapvBaseLayer.clear(this.mapvBaseLayer.getContext()),
              (this.mapvBaseLayer = void 0),
              this.canvas.parentElement.removeChild(this.canvas));
          },
        },
        {
          key: "update",
          value: function (t) {
            null != t && this.updateData(t.data, t.options);
          },
        },
        {
          key: "resizeCanvas",
          value: function () {
            var t;
            null != this.canvas &&
              null != this.canvas &&
              (((t = this.canvas).style.position = "absolute"),
              (t.style.top = "0px"),
              (t.style.left = "0px"),
              (t.width = parseInt(this.map.canvas.width)),
              (t.height = parseInt(this.map.canvas.height)),
              (t.style.width = this.map.canvas.style.width),
              (t.style.height = this.map.canvas.style.height));
          },
        },
        { key: "fixPosition", value: function () {} },
        { key: "onResize", value: function () {} },
        {
          key: "render",
          value: function () {
            null != this.mapvBaseLayer && this.mapvBaseLayer._canvasUpdate();
          },
        },
      ]),
      MapvLayer
    );
  })();
function mapv(viewer, dataSet1, options1) {
  return new MapvLayer(viewer, dataSet1, options1);
}
var Heatmap = (function () {
    function Heatmap(viewer, opt) {
      _classCallCheck(this, Heatmap),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.list = this.opt.list || []),
        !this.list || this.list.length < 2
          ? console.log("热力图点位不得少于3个！")
          : ((this.polygon = void 0),
            (this.dom = void 0),
            (this.id = Number(
              new Date().getTime() + "" + Number(1e3 * Math.random()).toFixed(0)
            )),
            (this.canvasw = 200),
            this.createDom(),
            (viewer = {
              container: document.getElementById(
                "vis3d-heatmap-".concat(this.id)
              ),
              radius: this.opt.raduis || 20,
              backgroundColor: "rgba(0,0,0,1)",
              maxOpacity: this.opt.maxOpacity || 0.7,
              minOpacity: 0.01,
              blur: this.opt.blur || 0.75,
              gradient: this.opt.gradient || {
                ".1": "blue",
                ".5": "yellow",
                ".7": "red",
                ".99": "white",
              },
            }),
            (this.heatmapInstance = h337.create(viewer)),
            this.init());
    }
    return (
      _createClass(Heatmap, [
        {
          key: "init",
          value: function () {
            this.hierarchy = [];
            for (var ind = 0; ind < this.list.length; ind++) {
              var position = Cesium.Cartesian3.fromDegrees(
                this.list[ind].lnglat[0],
                this.list[ind].lnglat[1]
              );
              this.hierarchy.push(position);
            }
            this.polygon = void 0;
            var bound = this.getBound(this.hierarchy);
            if (bound) {
              for (
                var points = [],
                  x_axios = Cesium.Cartesian3.subtract(
                    bound.rightTop,
                    bound.leftTop,
                    new Cesium.Cartesian3()
                  ),
                  x_axios = Cesium.Cartesian3.normalize(
                    x_axios,
                    new Cesium.Cartesian3()
                  ),
                  y_axios = Cesium.Cartesian3.subtract(
                    bound.leftBottom,
                    bound.leftTop,
                    new Cesium.Cartesian3()
                  ),
                  y_axios = Cesium.Cartesian3.normalize(
                    y_axios,
                    new Cesium.Cartesian3()
                  ),
                  girthX = Cesium.Cartesian3.distance(
                    bound.rightTop,
                    bound.leftTop
                  ),
                  girthY = Cesium.Cartesian3.distance(
                    bound.leftBottom,
                    bound.leftTop
                  ),
                  i = 0;
                i < this.hierarchy.length;
                i++
              ) {
                var p1 = this.hierarchy[i],
                  p1 = Cesium.Cartesian3.subtract(
                    p1,
                    bound.leftTop,
                    new Cesium.Cartesian3()
                  ),
                  diffX = Cesium.Cartesian3.dot(p1, x_axios),
                  p1 = Cesium.Cartesian3.dot(p1, y_axios);
                points.push({
                  x: Number((diffX / girthX) * this.canvasw).toFixed(0),
                  y: Number((p1 / girthY) * this.canvasw).toFixed(0),
                  value: this.list[i].value,
                });
              }
              this.heatmapInstance.setData({ max: 100, data: points }),
                this.createPolygon([
                  bound.leftTop,
                  bound.leftBottom,
                  bound.rightBottom,
                  bound.rightTop,
                ]);
            }
          },
        },
        {
          key: "createPolygon",
          value: function (positions) {
            (this.polygon = this.viewer.entities.add({
              polygon: {
                hierarchy: new Cesium.PolygonHierarchy(positions),
                material: this.heatmapInstance.getDataURL(),
                heightReference: 1,
              },
            })),
              this.opt.zoomTo && this.viewer.zoomTo(this.polygon);
          },
        },
        { key: "createProvider", value: function () {} },
        {
          key: "createDom",
          value: function () {
            (this.dom = window.document.createElement("div")),
              (this.dom.id = "vis3d-heatmap-".concat(this.id)),
              (this.dom.className = "vis3d-heatmap"),
              (this.dom.style.width = this.canvasw + "px"),
              (this.dom.style.height = this.canvasw + "px"),
              (this.dom.style.position = "absolute"),
              (this.dom.style.display = "none"),
              window.document
                .getElementById(this.viewer.container.id)
                .appendChild(this.dom);
          },
        },
        {
          key: "destroy",
          value: function () {
            var dom = document.getElementById("vis3d-heatmap-".concat(this.id));
            dom && dom.remove(),
              this.polygon &&
                (this.viewer.entities.remove(this.polygon),
                (this.polygon = void 0));
          },
        },
        {
          key: "getBound",
          value: function (positions) {
            for (
              var positions = this.toRectangle(positions),
                lnglats = util$1.cartesiansToLnglats(positions, this.viewer),
                minLat = Number.MAX_VALUE,
                maxLat = Number.MIN_VALUE,
                minLng = Number.MAX_VALUE,
                maxLng = Number.MIN_VALUE,
                length = positions.length,
                i = 0;
              i < length;
              i++
            ) {
              var lnglat = lnglats[i];
              lnglat[0] < minLng && (minLng = lnglat[0]),
                lnglat[0] > maxLng && (maxLng = lnglat[0]),
                lnglat[1] < minLat && (minLat = lnglat[1]),
                lnglat[1] > maxLat && (maxLat = lnglat[1]);
            }
            var positions = maxLat - minLat,
              diff_lng = maxLng - minLng;
            return (
              (minLat -= positions / length),
              (maxLat += positions / length),
              (minLng -= diff_lng / length),
              (maxLng += diff_lng / length),
              {
                leftTop: Cesium.Cartesian3.fromDegrees(minLng, maxLat),
                leftBottom: Cesium.Cartesian3.fromDegrees(minLng, minLat),
                rightTop: Cesium.Cartesian3.fromDegrees(maxLng, maxLat),
                rightBottom: Cesium.Cartesian3.fromDegrees(maxLng, minLat),
              }
            );
          },
        },
        {
          key: "toRectangle",
          value: function (hierarchy) {
            if (hierarchy) {
              for (
                var hierarchy = Cesium.BoundingSphere.fromPoints(
                    hierarchy,
                    new Cesium.BoundingSphere()
                  ),
                  center = hierarchy.center,
                  radius = hierarchy.radius,
                  modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
                    center.clone()
                  ),
                  roate_y =
                    (Cesium.Matrix4.inverse(
                      modelMatrix.clone(),
                      new Cesium.Matrix4()
                    ),
                    new Cesium.Cartesian3(0, 1, 0)),
                  arr = [],
                  i = 45;
                i <= 360;
                i += 90
              ) {
                var roateZ_mtx = Cesium.Matrix3.fromRotationZ(
                    Cesium.Math.toRadians(i),
                    new Cesium.Matrix3()
                  ),
                  roateZ_mtx = Cesium.Matrix3.multiplyByVector(
                    roateZ_mtx,
                    roate_y,
                    new Cesium.Cartesian3()
                  ),
                  roateZ_mtx = Cesium.Cartesian3.normalize(
                    roateZ_mtx,
                    new Cesium.Cartesian3()
                  ),
                  roateZ_mtx = Cesium.Cartesian3.multiplyByScalar(
                    roateZ_mtx,
                    radius,
                    new Cesium.Cartesian3()
                  ),
                  roateZ_mtx = Cesium.Matrix4.multiplyByPoint(
                    modelMatrix,
                    roateZ_mtx.clone(),
                    new Cesium.Cartesian3()
                  );
                arr.push(roateZ_mtx);
              }
              return arr;
            }
          },
        },
      ]),
      Heatmap
    );
  })(),
  Heatmap3d = (function () {
    function Heatmap3d(viewer, opt) {
      _classCallCheck(this, Heatmap3d),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this.list = this.opt.list || []),
        !this.list || this.list.length < 2
          ? console.log("热力图点位不得少于3个！")
          : ((this.dom = void 0),
            (this.id = Number(
              new Date().getTime() + "" + Number(1e3 * Math.random()).toFixed(0)
            )),
            (this.canvasw = 200),
            (this.bound = void 0),
            (this.rect = {}),
            (this.x_axios = void 0),
            (this.y_axios = void 0),
            (this.girthX = 0),
            (this.girthY = 0),
            (this.baseHeight = this.opt.baseHeight || 0),
            this.createDom(),
            (viewer = {
              container: document.getElementById(
                "easy3d-heatmap-".concat(this.id)
              ),
              radius: this.opt.raduis || 20,
              maxOpacity: 0.7,
              minOpacity: 0,
              blur: 0.75,
              gradient: this.opt.gradient || {
                ".1": "blue",
                ".5": "yellow",
                ".7": "red",
                ".99": "white",
              },
            }),
            (this.primitiveType = opt.primitiveType || "TRIANGLES"),
            (this.heatmapInstance = h337.create(viewer)),
            (this.primitive = void 0),
            this.init());
    }
    return (
      _createClass(Heatmap3d, [
        {
          key: "init",
          value: function () {
            this.hierarchy = [];
            for (var ind = 0; ind < this.list.length; ind++) {
              var position = Cesium.Cartesian3.fromDegrees(
                this.list[ind].lnglat[0],
                this.list[ind].lnglat[1],
                0
              );
              this.hierarchy.push(position);
            }
            this.computeBound(this.hierarchy);
            for (var points = [], i = 0; i < this.hierarchy.length; i++) {
              var p1 = this.hierarchy[i],
                p1 = this.computeRateInBound(p1);
              points.push({ x: p1.x, y: p1.y, value: this.list[i].value });
            }
            this.heatmapInstance.addData(points);
            var instance = new Cesium.GeometryInstance({
              geometry: this.createGeometry(),
            });
            (this.primitive = this.viewer.scene.primitives.add(
              new Cesium.Primitive({
                geometryInstances: instance,
                appearance: new Cesium.MaterialAppearance({
                  material: new Cesium.Material({
                    fabric: {
                      type: "Image",
                      uniforms: { image: this.heatmapInstance.getDataURL() },
                    },
                  }),
                  translucent: !0,
                  flat: !0,
                }),
                asynchronous: !1,
              })
            )),
              (this.primitive.id = "heatmap3d");
          },
        },
        {
          key: "destroy",
          value: function () {
            var dom = document.getElementById(
              "easy3d-heatmap-".concat(this.id)
            );
            dom && dom.remove(),
              this.primitive &&
                (this.viewer.scene.primitives.remove(this.primitive),
                (this.primitive = void 0));
          },
        },
        {
          key: "computeRateInBound",
          value: function (position) {
            var ctgc;
            if (position)
              return (
                ((ctgc = Cesium.Cartographic.fromCartesian(
                  position.clone()
                )).height = 0),
                (position = Cesium.Cartographic.toCartesian(ctgc.clone())),
                (ctgc = Cesium.Cartesian3.subtract(
                  position.clone(),
                  this.bound.leftTop,
                  new Cesium.Cartesian3()
                )),
                (position = Cesium.Cartesian3.dot(ctgc, this.x_axios)),
                (ctgc = Cesium.Cartesian3.dot(ctgc, this.y_axios)),
                {
                  x: Number((position / this.girthX) * this.canvasw).toFixed(0),
                  y: Number((ctgc / this.girthY) * this.canvasw).toFixed(0),
                }
              );
          },
        },
        {
          key: "computeBound",
          value: function (positions) {
            if (positions) {
              for (
                var positions = Cesium.BoundingSphere.fromPoints(
                    positions,
                    new Cesium.BoundingSphere()
                  ),
                  center = positions.center,
                  radius = positions.radius,
                  modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
                    center.clone()
                  ),
                  roate_y = new Cesium.Cartesian3(0, 1, 0),
                  rect = [],
                  i = 45;
                i <= 360;
                i += 90
              ) {
                var roateZ_mtx = Cesium.Matrix3.fromRotationZ(
                    Cesium.Math.toRadians(i),
                    new Cesium.Matrix3()
                  ),
                  roateZ_mtx = Cesium.Matrix3.multiplyByVector(
                    roateZ_mtx,
                    roate_y,
                    new Cesium.Cartesian3()
                  ),
                  roateZ_mtx = Cesium.Cartesian3.normalize(
                    roateZ_mtx,
                    new Cesium.Cartesian3()
                  ),
                  roateZ_mtx = Cesium.Cartesian3.multiplyByScalar(
                    roateZ_mtx,
                    radius,
                    new Cesium.Cartesian3()
                  ),
                  roateZ_mtx = Cesium.Matrix4.multiplyByPoint(
                    modelMatrix,
                    roateZ_mtx.clone(),
                    new Cesium.Cartesian3()
                  );
                rect.push(roateZ_mtx);
              }
              for (
                var lnglats = util$1.cartesiansToLnglats(rect, this.viewer),
                  minLat = Number.MAX_VALUE,
                  maxLat = Number.MIN_VALUE,
                  minLng = Number.MAX_VALUE,
                  maxLng = Number.MIN_VALUE,
                  length = rect.length,
                  _i = 0;
                _i < length;
                _i++
              ) {
                var lnglat = lnglats[_i];
                lnglat[0] < minLng && (minLng = lnglat[0]),
                  lnglat[0] > maxLng && (maxLng = lnglat[0]),
                  lnglat[1] < minLat && (minLat = lnglat[1]),
                  lnglat[1] > maxLat && (maxLat = lnglat[1]);
              }
              (positions = maxLat - minLat), (center = maxLng - minLng);
              (this.rect.minLat = minLat - positions / length),
                (this.rect.maxLat = maxLat + positions / length),
                (this.rect.minLng = minLng - center / length),
                (this.rect.maxLng = maxLng + center / length),
                (this.bound = {
                  leftTop: Cesium.Cartesian3.fromDegrees(
                    this.rect.minLng,
                    this.rect.maxLat
                  ),
                  leftBottom: Cesium.Cartesian3.fromDegrees(
                    this.rect.minLng,
                    this.rect.minLat
                  ),
                  rightTop: Cesium.Cartesian3.fromDegrees(
                    this.rect.maxLng,
                    this.rect.maxLat
                  ),
                  rightBottom: Cesium.Cartesian3.fromDegrees(
                    this.rect.maxLng,
                    this.rect.minLat
                  ),
                }),
                (this.x_axios = Cesium.Cartesian3.subtract(
                  this.bound.rightTop,
                  this.bound.leftTop,
                  new Cesium.Cartesian3()
                )),
                (this.x_axios = Cesium.Cartesian3.normalize(
                  this.x_axios,
                  new Cesium.Cartesian3()
                )),
                (this.y_axios = Cesium.Cartesian3.subtract(
                  this.bound.leftBottom,
                  this.bound.leftTop,
                  new Cesium.Cartesian3()
                )),
                (this.y_axios = Cesium.Cartesian3.normalize(
                  this.y_axios,
                  new Cesium.Cartesian3()
                )),
                (this.girthX = Cesium.Cartesian3.distance(
                  this.bound.rightTop,
                  this.bound.leftTop
                )),
                (this.girthY = Cesium.Cartesian3.distance(
                  this.bound.leftBottom,
                  this.bound.leftTop
                ));
            }
          },
        },
        {
          key: "createGeometry",
          value: function () {
            var opt = this.getGrain();
            return new Cesium.Geometry({
              attributes: new Cesium.GeometryAttributes({
                position: new Cesium.GeometryAttribute({
                  componentDatatype: Cesium.ComponentDatatype.DOUBLE,
                  componentsPerAttribute: 3,
                  values: opt.positions,
                }),
                st: new Cesium.GeometryAttribute({
                  componentDatatype: Cesium.ComponentDatatype.FLOAT,
                  componentsPerAttribute: 2,
                  values: new Float32Array(opt.st),
                }),
              }),
              indices: new Uint16Array(opt.indices),
              primitiveType: Cesium.PrimitiveType[this.primitiveType],
              boundingSphere: Cesium.BoundingSphere.fromVertices(opt.positions),
            });
          },
        },
        {
          key: "getGrain",
          value: function (opt) {
            for (
              var canvasW = this.canvasW || 200,
                canvasH = this.canvasW || 200,
                maxLng = this.rect.maxLng,
                maxLat = this.rect.maxLat,
                minLng = this.rect.minLng,
                minLat = this.rect.minLat,
                granLng_w = (maxLng - minLng) / canvasW,
                granLat_H = (maxLat - minLat) / canvasH,
                positions = [],
                st = [],
                indices = [],
                i = 0;
              i < canvasW;
              i++
            )
              for (
                var nowLng = minLng + granLng_w * i, j = 0;
                j < canvasH;
                j++
              ) {
                var nowLat = minLat + granLat_H * j,
                  value = this.heatmapInstance.getValueAt({ x: i, y: j }),
                  nowLat = Cesium.Cartesian3.fromDegrees(
                    nowLng,
                    nowLat,
                    this.baseHeight + value
                  );
                positions.push(nowLat.x, nowLat.y, nowLat.z),
                  st.push(i / canvasW, j / canvasH),
                  j != canvasH - 1 &&
                    i != canvasW - 1 &&
                    (indices.push(
                      i * canvasH + j,
                      i * canvasH + j + 1,
                      (i + 1) * canvasH + j
                    ),
                    indices.push(
                      (i + 1) * canvasH + j,
                      (i + 1) * canvasH + j + 1,
                      i * canvasH + j + 1
                    ));
              }
            return { positions: positions, st: st, indices: indices };
          },
        },
        {
          key: "createDom",
          value: function () {
            (this.dom = window.document.createElement("div")),
              (this.dom.id = "easy3d-heatmap-".concat(this.id)),
              (this.dom.className = "easy3d-heatmap"),
              (this.dom.style.width = this.canvasw + "px"),
              (this.dom.style.height = this.canvasw + "px"),
              (this.dom.style.position = "absolute"),
              (this.dom.style.display = "none"),
              window.document
                .getElementById(this.viewer.container.id)
                .appendChild(this.dom);
          },
        },
      ]),
      Heatmap3d
    );
  })(),
  Cesium$b = window.Cesium;
function r(t, e) {
  var r = Math.cos,
    o = Math.sin;
  return [r(-t) * r(e), o(-t) * r(e), o(e)];
}
function o(t, e, i, n) {
  return t + (n / i) * (e - t);
}
function a$2(t, e) {
  var n,
    i = e.findIndex(function (e) {
      return e.fov > t;
    });
  if (0 < i)
    return (
      (n = e[i - 1]),
      (e = e[i]),
      (i = (t - n.fov) / (e.fov - n.fov)),
      n.radius * (1 - i) + e.radius * i
    );
}
function s(t, e, i, n, s, u, l) {
  for (var h = new Float32Array((s + 1) * (u + 1) * 3), d = 0; d < s + 1; ++d)
    for (var m = 0; m < u + 1; ++m) {
      var f = o(i, n, u, m),
        p = r(o(t, e, s, d), f),
        f = l ? a$2(f, l) : 1;
      (h[3 * (m * (s + 1) + d) + 0] = p[0] * f),
        (h[3 * (m * (s + 1) + d) + 1] = p[1] * f),
        (h[3 * (m * (s + 1) + d) + 2] = p[2] * f);
    }
  return h;
}
function u(t, e, i, n, s, u, l) {
  for (var h = new Float32Array((n + 1) * (s + 1) * 3), d = 0; d < n + 1; ++d)
    for (var m = 0; m < s + 1; ++m) {
      var f = o(e, i, s, m),
        p = r(t, f),
        f = o(u ? a$2(f, u) : 1, l ? a$2(f, l) : 1, n, d);
      (h[3 * (m * (n + 1) + d) + 0] = p[0] * f),
        (h[3 * (m * (n + 1) + d) + 1] = p[1] * f),
        (h[3 * (m * (n + 1) + d) + 2] = p[2] * f);
    }
  return h;
}
function l$1(t, e) {
  for (var i = new Uint16Array(t * e * 6), n = 0; n < t; ++n)
    for (var r = 0; r < e; ++r) {
      var o = r * (t + 1) + n,
        a = r * (t + 1) + n + 1,
        s = (r + 1) * (t + 1) + n,
        u = (r + 1) * (t + 1) + n + 1,
        l = 6 * (r * t + n);
      (i[0 + l] = o),
        (i[1 + l] = a),
        (i[2 + l] = u),
        (i[3 + l] = o),
        (i[4 + l] = u),
        (i[5 + l] = s);
    }
  return i;
}
function h$1(t, e, i, n) {
  for (
    var r = t * i,
      o = e * n,
      a = new Uint16Array((t + 1) * (2 * o) + (e + 1) * (2 * r) + 8),
      s = 0;
    s < t + 1;
    ++s
  )
    for (var u = 0; u < o; ++u) {
      var l = s * i;
      (a[2 * (s * o + u) + 0] = u * (1 + r) + l),
        (a[2 * (s * o + u) + 1] = (u + 1) * (1 + r) + l);
    }
  for (var h = (t + 1) * (2 * o), d = 0; d < e + 1; ++d)
    for (var m = 0; m < r; ++m) {
      var f = d * n;
      (a[h + 2 * (m + d * r)] = f * (1 + r) + m),
        (a[h + 2 * (m + d * r) + 1] = f * (1 + r) + m + 1);
    }
  return a;
}
var c =
    "\nin vec3 position;\n            \nin vec3 normal;\n            \nout vec3 v_positionEC;\n            \nout vec3 v_normalEC;\n            \nvoid main()\n            \n {\n               \n    v_positionEC = (czm_modelView * vec4(position, 1.0)).xyz;       \n    v_normalEC = czm_normal * normal;                               \n    gl_Position = czm_modelViewProjection * vec4(position, 1.0);\n         \n}\n           ",
  _ =
    "\n            \nin vec3 v_positionEC;\n            \nin vec3 v_normalEC;\n            \nuniform vec4 color;\n\n            \nvoid main(){\n               \n        vec3 positionToEyeEC = -v_positionEC;\n\n                \n        vec3 normalEC = normalize(v_normalEC);\n           \n        #ifdef FACE_FORWARD\n                \n        normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n           \n        #endif\n\n                \n        czm_materialInput materialInput;\n               \n        materialInput.normalEC = normalEC;\n               \n        materialInput.positionToEyeEC = positionToEyeEC;\n               \n        czm_material material = czm_getDefaultMaterial(materialInput);\n                \n        material.diffuse = color.rgb;\n               \n        material.alpha = color.a;\n\n        \n        out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n           \n        // #ifdef FLAT\n                \n        //     gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n            \n        // #else\n               \n        //     // gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n           \n        // #endif\n           \n    }\n            ",
  CamberRadarPrimitive = function (e) {
    (this.innerFovRadiusPairs = e.innerFovRadiusPairs),
      (this.outerFovRadiusPairs = e.outerFovRadiusPairs),
      (this.radius = e.radius),
      (this.startRadius = e.startRadius),
      (this.modelMatrix = Cesium$b.defaultValue(
        e.modelMatrix,
        Cesium$b.Matrix4.IDENTITY
      )),
      (this.startFovH = Cesium$b.defaultValue(
        e.startFovH,
        Cesium$b.Math.toRadians(-50)
      )),
      (this.endFovH = Cesium$b.defaultValue(
        e.endFovH,
        Cesium$b.Math.toRadians(50)
      )),
      (this.startFovV = Cesium$b.defaultValue(
        e.startFovV,
        Cesium$b.Math.toRadians(5)
      )),
      (this.endFovV = Cesium$b.defaultValue(
        e.endFovV,
        Cesium$b.Math.toRadians(85)
      )),
      (this.segmentH = Cesium$b.defaultValue(e.segmentH, 20)),
      (this.segmentV = Cesium$b.defaultValue(e.segmentV, 20)),
      (this.subSegmentH = Cesium$b.defaultValue(e.subSegmentH, 3)),
      (this.subSegmentV = Cesium$b.defaultValue(e.subSegmentV, 3)),
      (this.color = Cesium$b.defaultValue(
        e.color,
        new Cesium$b.Color(1, 1, 0, 0.5)
      )),
      (this.lineColor = Cesium$b.defaultValue(
        e.lineColor,
        new Cesium$b.Color(1, 0, 0)
      )),
      (this.show = Cesium$b.defaultValue(e.show, !0)),
      (this._modelMatrix = Cesium$b.Matrix4.clone(Cesium$b.Matrix4.IDENTITY)),
      (this._startFovH = 0),
      (this._endFovH = 0),
      (this._startFovV = 0),
      (this._endFovV = 0),
      (this._segmentH = 1),
      (this._segmentV = 1),
      (this._subSegmentH = 1),
      (this._subSegmentV = 1),
      (this._boundingSphere = new Cesium$b.BoundingSphere()),
      (this._initBoundingSphere = void 0),
      (this._command = void 0);
  },
  Cesium$c =
    ((CamberRadarPrimitive.prototype.createOuterCurveCommand = function (t) {
      var e = this._subSegmentH * this._segmentH,
        i = this._subSegmentV * this._segmentV,
        n = s(
          this._startFovH,
          this._endFovH,
          this._startFovV,
          this._endFovV,
          e,
          i,
          this._outerFovRadiusPairs
        ),
        r = s(
          this._startFovH,
          this._endFovH,
          this._startFovV,
          this._endFovV,
          e,
          i,
          this._outerFovRadiusPairs
        ),
        e = l$1(e, i),
        i = h$1(
          this._segmentH,
          this._segmentV,
          this._subSegmentH,
          this._subSegmentV
        );
      return this.createRawCommand(t, n, r, e, i);
    }),
    (CamberRadarPrimitive.prototype.createInnerCurveCommand = function (t) {
      var e = this._subSegmentH * this._segmentH,
        i = this._subSegmentV * this._segmentV,
        n = s(
          this._startFovH,
          this._endFovH,
          this._startFovV,
          this._endFovV,
          e,
          i,
          this._innerFovRadiusPairs
        ),
        r = s(
          this._startFovH,
          this._endFovH,
          this._startFovV,
          this._endFovV,
          e,
          i,
          this._innerFovRadiusPairs
        ),
        e = l$1(e, i),
        i = h$1(
          this._segmentH,
          this._segmentV,
          this._subSegmentH,
          this._subSegmentV
        );
      return this.createRawCommand(t, n, r, e, i);
    }),
    (CamberRadarPrimitive.prototype.createLeftCrossSectionCommand = function (
      t
    ) {
      var e = this._subSegmentV * this._segmentV,
        i = u(
          this._startFovH,
          this._startFovV,
          this._endFovV,
          10,
          e,
          this._innerFovRadiusPairs,
          this._outerFovRadiusPairs
        ),
        n = u(
          this._startFovH,
          this._startFovV,
          this._endFovV,
          10,
          e,
          this._innerFovRadiusPairs,
          this._outerFovRadiusPairs
        ),
        e = l$1(10, e),
        o = h$1(10, this._segmentV, 1, this._subSegmentV);
      return this.createRawCommand(t, i, n, e, o);
    }),
    (CamberRadarPrimitive.prototype.createRightCrossSectionCommand = function (
      t
    ) {
      var e = this._subSegmentV * this._segmentV,
        i = u(
          this._endFovH,
          this._startFovV,
          this._endFovV,
          10,
          e,
          this._innerFovRadiusPairs,
          this._outerFovRadiusPairs
        ),
        n = u(
          this._endFovH,
          this._startFovV,
          this._endFovV,
          10,
          e,
          this._innerFovRadiusPairs,
          this._outerFovRadiusPairs
        ),
        e = l$1(10, e),
        o = h$1(10, this._segmentV, 1, this._subSegmentV);
      return this.createRawCommand(t, i, n, e, o);
    }),
    (CamberRadarPrimitive.prototype.createRawCommand = function (
      t,
      e,
      i,
      n,
      r
    ) {
      var o = this,
        a = Cesium$b.Appearance.getDefaultRenderState(!0, !1, void 0),
        a = Cesium$b.RenderState.fromCache(a),
        u = new Cesium$b.ShaderSource({ sources: [c] }),
        l = new Cesium$b.ShaderSource({ sources: [_] }),
        h = {
          color: function () {
            return o.color;
          },
        },
        d = {
          color: function () {
            return o.lineColor;
          },
        },
        u = Cesium$b.ShaderProgram.fromCache({
          context: t,
          vertexShaderSource: u,
          fragmentShaderSource: l,
          attributeLocations: { position: 0, normal: 1 },
        }),
        l = Cesium$b.Buffer.createVertexBuffer({
          context: t,
          typedArray: e,
          usage: Cesium$b.BufferUsage.STATIC_DRAW,
        }),
        i = Cesium$b.Buffer.createVertexBuffer({
          context: t,
          typedArray: i,
          usage: Cesium$b.BufferUsage.STATIC_DRAW,
        }),
        n = Cesium$b.Buffer.createIndexBuffer({
          context: t,
          typedArray: n,
          usage: Cesium$b.BufferUsage.STATIC_DRAW,
          indexDatatype: Cesium$b.IndexDatatype.UNSIGNED_SHORT,
        }),
        r = Cesium$b.Buffer.createIndexBuffer({
          context: t,
          typedArray: r,
          usage: Cesium$b.BufferUsage.STATIC_DRAW,
          indexDatatype: Cesium$b.IndexDatatype.UNSIGNED_SHORT,
        }),
        n = new Cesium$b.VertexArray({
          context: t,
          attributes: [
            {
              index: 0,
              vertexBuffer: l,
              componentsPerAttribute: 3,
              componentDatatype: Cesium$b.ComponentDatatype.FLOAT,
            },
            {
              index: 1,
              vertexBuffer: i,
              componentsPerAttribute: 3,
              componentDatatype: Cesium$b.ComponentDatatype.FLOAT,
            },
          ],
          indexBuffer: n,
        }),
        t = new Cesium$b.VertexArray({
          context: t,
          attributes: [
            {
              index: 0,
              vertexBuffer: l,
              componentsPerAttribute: 3,
              componentDatatype: Cesium$b.ComponentDatatype.FLOAT,
            },
            {
              index: 1,
              vertexBuffer: i,
              componentsPerAttribute: 3,
              componentDatatype: Cesium$b.ComponentDatatype.FLOAT,
            },
          ],
          indexBuffer: r,
        }),
        l = Cesium$b.BoundingSphere.fromVertices(e);
      return {
        command: new Cesium$b.DrawCommand({
          vertexArray: n,
          primitiveType: Cesium$b.PrimitiveType.TRIANGLES,
          renderState: a,
          shaderProgram: u,
          uniformMap: h,
          owner: this,
          pass: Cesium$b.Pass.TRANSLUCENT,
          modelMatrix: new Cesium$b.Matrix4(),
          boundingVolume: new Cesium$b.BoundingSphere(),
          cull: !0,
        }),
        lineCommand: new Cesium$b.DrawCommand({
          vertexArray: t,
          primitiveType: Cesium$b.PrimitiveType.LINES,
          renderState: a,
          shaderProgram: u,
          uniformMap: d,
          owner: this,
          pass: Cesium$b.Pass.TRANSLUCENT,
          modelMatrix: new Cesium$b.Matrix4(),
          boundingVolume: new Cesium$b.BoundingSphere(),
          cull: !0,
        }),
        initBoundingSphere: l,
      };
    }),
    (CamberRadarPrimitive.prototype.update = function (t) {
      var e = this;
      this.show &&
        ((this.innerFovRadiusPairs === this._innerFovRadiusPairs &&
          this.outerFovRadiusPairs === this._outerFovRadiusPairs &&
          this.startFovH === this._startFovH &&
          this.endFovH === this._endFovH &&
          this.startFovV === this._startFovV &&
          this.endFovV === this._endFovV &&
          this.segmentH === this._segmentH &&
          this.segmentV === this._segmentV &&
          this.subSegmentH === this._subSegmentH &&
          this.subSegmentV === this._subSegmentV) ||
          ((this._innerFovRadiusPairs = this.innerFovRadiusPairs),
          (this._outerFovRadiusPairs = this.outerFovRadiusPairs),
          (this._startFovH = this.startFovH),
          (this._endFovH = this.endFovH),
          (this._startFovV = this.startFovV),
          (this._endFovV = this.endFovV),
          (this._segmentH = this.segmentH),
          (this._segmentV = this.segmentV),
          (this._subSegmentH = this.subSegmentH),
          (this._subSegmentV = this.subSegmentV),
          (this._modelMatrix = Cesium$b.clone(Cesium$b.Matrix4.IDENTITY)),
          this.destroyCommands()),
        (Cesium$b.defined(this._commands) && 0 !== this._commands.length) ||
          (this._commands || (this._commands = []),
          this._commands.push(this.createOuterCurveCommand(t.context)),
          this._commands.push(this.createLeftCrossSectionCommand(t.context)),
          this._commands.push(this.createRightCrossSectionCommand(t.context)),
          this._commands.push(this.createInnerCurveCommand(t.context))),
        Cesium$b.Matrix4.equals(this.modelMatrix, this._modelMatrix) ||
          (Cesium$b.Matrix4.clone(this.modelMatrix, this._modelMatrix),
          this._commands.forEach(function (t) {
            (t.command.modelMatrix = Cesium$b.Matrix4.IDENTITY),
              (t.command.modelMatrix = e._modelMatrix),
              (t.command.boundingVolume = Cesium$b.BoundingSphere.transform(
                t.initBoundingSphere,
                e._modelMatrix,
                e._boundingSphere
              )),
              (t.lineCommand.modelMatrix = Cesium$b.Matrix4.IDENTITY),
              (t.lineCommand.modelMatrix = e._modelMatrix),
              (t.lineCommand.boundingVolume = Cesium$b.BoundingSphere.transform(
                t.initBoundingSphere,
                e._modelMatrix,
                e._boundingSphere
              ));
          })),
        this._commands.forEach(function (e) {
          e.command && t.commandList.push(e.command),
            e.lineCommand && t.commandList.push(e.lineCommand);
        }));
    }),
    (CamberRadarPrimitive.prototype.destroyCommands = function () {
      this._commands &&
        this._commands.forEach(function (t) {
          Cesium$b.defined(t.command) &&
            ((t.command.shaderProgram =
              t.command.shaderProgram && t.command.shaderProgram.destroy()),
            (t.command.vertexArray =
              t.command.vertexArray && t.command.vertexArray.destroy()),
            (t.command = void 0)),
            Cesium$b.defined(t.lineCommand) &&
              ((t.lineCommand.shaderProgram =
                t.lineCommand.shaderProgram &&
                t.lineCommand.shaderProgram.destroy()),
              (t.lineCommand.vertexArray =
                t.lineCommand.vertexArray &&
                t.lineCommand.vertexArray.destroy()),
              (t.lineCommand = void 0));
        }),
        this._commands && (this._commands.length = 0);
    }),
    (CamberRadarPrimitive.prototype.destroy = function () {
      return this.destroyCommands(), Cesium$b.destroyObject(this);
    }),
    Object.defineProperties(CamberRadarPrimitive.prototype, {
      startRadius: {
        get: function () {
          return this._startRadius;
        },
        set: function (t) {
          (this._startRadius = t),
            (this.innerFovRadiusPairs = [
              { fov: Cesium$b.Math.toRadians(0), radius: t },
              { fov: Cesium$b.Math.toRadians(10), radius: 0.9 * t },
              { fov: Cesium$b.Math.toRadians(20), radius: 0.8 * t },
              { fov: Cesium$b.Math.toRadians(30), radius: 0.7 * t },
              { fov: Cesium$b.Math.toRadians(40), radius: 0.6 * t },
              { fov: Cesium$b.Math.toRadians(50), radius: 0.5 * t },
              { fov: Cesium$b.Math.toRadians(60), radius: 0.4 * t },
              { fov: Cesium$b.Math.toRadians(70), radius: 0.3 * t },
              { fov: Cesium$b.Math.toRadians(80), radius: 0.1 * t },
              { fov: Cesium$b.Math.toRadians(90), radius: 0.01 * t },
            ]);
        },
      },
      radius: {
        get: function () {
          return this._radius;
        },
        set: function (t) {
          (this._radius = t),
            (this.outerFovRadiusPairs = [
              { fov: Cesium$b.Math.toRadians(0), radius: t },
              { fov: Cesium$b.Math.toRadians(10), radius: 0.9 * t },
              { fov: Cesium$b.Math.toRadians(20), radius: 0.8 * t },
              { fov: Cesium$b.Math.toRadians(30), radius: 0.7 * t },
              { fov: Cesium$b.Math.toRadians(40), radius: 0.6 * t },
              { fov: Cesium$b.Math.toRadians(50), radius: 0.5 * t },
              { fov: Cesium$b.Math.toRadians(60), radius: 0.4 * t },
              { fov: Cesium$b.Math.toRadians(70), radius: 0.3 * t },
              { fov: Cesium$b.Math.toRadians(80), radius: 0.1 * t },
              { fov: Cesium$b.Math.toRadians(90), radius: 0.01 * t },
            ]);
        },
      },
    }),
    window.Cesium);
function getNormal(t) {
  for (
    var e, i, n, r, o = t.attributes.normal.values, a = 0;
    a < o.length;
    a += 3
  )
    (e = o[a]),
      (i = o[a + 1]),
      (n = o[a + 2]),
      (r = 1 / Math.sqrt(e * e + i * i + n * n)),
      (o[a] = e * r),
      (o[a + 1] = i * r),
      (o[a + 2] = n * r);
}
function computeVertexNormals(t) {
  var e = t.indices,
    i = t.attributes,
    n = e.length;
  if (i.position) {
    var o = i.position.values;
    if (void 0 === i.normal)
      i.normal = new Cesium$c.GeometryAttribute({
        componentDatatype: Cesium$c.ComponentDatatype.FLOAT,
        componentsPerAttribute: 3,
        values: new Float32Array(o.length),
      });
    else for (var a = i.normal.values, s = 0; s < n; s++) a[s] = 0;
    for (
      var u,
        l,
        h,
        d = i.normal.values,
        m = new Cesium$c.Cartesian3(),
        f = new Cesium$c.Cartesian3(),
        p = new Cesium$c.Cartesian3(),
        c = new Cesium$c.Cartesian3(),
        _ = new Cesium$c.Cartesian3(),
        s = 0;
      s < n;
      s += 3
    )
      (u = 3 * e[s + 0]),
        (l = 3 * e[s + 1]),
        (h = 3 * e[s + 2]),
        Cesium$c.Cartesian3.fromArray(o, u, m),
        Cesium$c.Cartesian3.fromArray(o, l, f),
        Cesium$c.Cartesian3.fromArray(o, h, p),
        Cesium$c.Cartesian3.subtract(p, f, c),
        Cesium$c.Cartesian3.subtract(m, f, _),
        Cesium$c.Cartesian3.cross(c, _, c),
        (d[u] += c.x),
        (d[1 + u] += c.y),
        (d[2 + u] += c.z),
        (d[l] += c.x),
        (d[1 + l] += c.y),
        (d[2 + l] += c.z),
        (d[h] += c.x),
        (d[1 + h] += c.y),
        (d[2 + h] += c.z);
    getNormal(t), (i.normal.needsUpdate = !0);
  }
  return t;
}
function CylinderGeometry(t) {
  (this.length = t.length),
    (this.topRadius = t.topRadius),
    (this.bottomRadius = t.bottomRadius),
    (this.slices = t.slices || 64),
    (this.zReverse = t.zReverse);
}
var s$1 = new Cesium$c.Cartesian2(),
  u$1 = new Cesium$c.Cartesian3(),
  l$2 = new Cesium$c.Ray(),
  Cesium$d =
    ((CylinderGeometry._createGeometry = function (t) {
      var e = t.length,
        i = t.topRadius,
        n = t.bottomRadius,
        r = t.slices,
        a = (2 * Math.PI) / (r - 1),
        l = [],
        h = [],
        d = [],
        m = [],
        f = [n, i],
        p = [0, t.zReverse ? -e : e],
        c = 0,
        t = Math.atan2(n - i, e),
        g = s$1;
      g.z = Math.sin(t);
      for (var v = Math.cos(t), y = 0; y < p.length; y++) {
        m[y] = [];
        for (var C = f[y], w = 0; w < r; w++) {
          m[y].push(c++);
          var x = a * w,
            A = C * Math.cos(x),
            b = C * Math.sin(x);
          l.push(A, b, p[y]),
            (A = v * Math.cos(x)),
            (b = v * Math.sin(x)),
            h.push(A, b, g.z),
            d.push(y / (p.length - 1), 0);
        }
      }
      for (var M = [], y = 1; y < p.length; y++)
        for (w = 1; w < r; w++) {
          var P = m[y - 1][w - 1],
            S = m[y][w - 1],
            F = m[y][w],
            E = m[y - 1][w];
          M.push(F),
            M.push(E),
            M.push(P),
            M.push(F),
            M.push(P),
            M.push(S),
            w == m[y].length - 1 &&
              ((P = m[y - 1][w]),
              (S = m[y][w]),
              (F = m[y][0]),
              (E = m[y - 1][0]),
              M.push(F),
              M.push(E),
              M.push(P),
              M.push(F),
              M.push(P),
              M.push(S));
        }
      (M = new Int16Array(M)),
        (l = new Float32Array(l)),
        (h = new Float32Array(h)),
        (d = new Float32Array(d)),
        (n = {
          position: new Cesium$c.GeometryAttribute({
            componentDatatype: Cesium$c.ComponentDatatype.DOUBLE,
            componentsPerAttribute: 3,
            values: l,
          }),
          normal: new Cesium$c.GeometryAttribute({
            componentDatatype: Cesium$c.ComponentDatatype.FLOAT,
            componentsPerAttribute: 3,
            values: h,
          }),
          st: new Cesium$c.GeometryAttribute({
            componentDatatype: Cesium$c.ComponentDatatype.FLOAT,
            componentsPerAttribute: 2,
            values: d,
          }),
        }),
        (i = Cesium$c.BoundingSphere.fromVertices(l)),
        (e = new Cesium$c.Geometry({
          attributes: n,
          indices: M,
          primitiveType: Cesium$c.PrimitiveType.TRIANGLES,
          boundingSphere: i,
        }));
      return (l = []), (M = []), (d = []), e;
    }),
    (CylinderGeometry.createGeometry = function (t, e) {
      if (!e) return this._createGeometry(t);
      Cesium$c.Matrix4.multiplyByPoint(e, Cesium$c.Cartesian3.ZERO, u$1),
        u$1.clone(l$2.origin);
      var i = t.length,
        r = t.topRadius,
        s = (t.bottomRadius, t.slices),
        h = (2 * Math.PI) / (s - 1),
        f = [],
        p = [],
        c = [],
        _ = [0, t.zReverse ? -i : i],
        g = 0,
        g = 0;
      (m = []).push(0, 0, 0), f.push(1, 1), g++;
      for (var v = new Cesium$c.Cartesian3(), y = r / 15, C = 0; C < 16; C++) {
        for (var w = y * C, x = [], A = 0; A < s; A++) {
          var b = h * A,
            M = w * Math.cos(b),
            b = w * Math.sin(b);
          (v.x = M),
            (v.y = b),
            (v.z = _[1]),
            (0, a.extend2Earth)(v, e, l$2)
              ? (x.push(g), m.push(M, b, _[1]), f.push(C / 15, 1), g++)
              : x.push(-1);
        }
        c.push(x);
      }
      for (var F, E, T = [0, c.length - 1], R = 0; R < T.length; R++)
        for (C = T[R], A = 1; A < c[C].length; A++)
          (F = c[C][A - 1]), (E = c[C][A]), 0 <= F && 0 <= E && p.push(0, F, E);
      var m = new Float32Array(m),
        p = new Int32Array(p),
        f = new Float32Array(f),
        t = {
          position: new Cesium$c.GeometryAttribute({
            componentDatatype: Cesium$c.ComponentDatatype.DOUBLE,
            componentsPerAttribute: 3,
            values: m,
          }),
          st: new Cesium$c.GeometryAttribute({
            componentDatatype: Cesium$c.ComponentDatatype.FLOAT,
            componentsPerAttribute: 2,
            values: f,
          }),
        },
        i = Cesium$c.BoundingSphere.fromVertices(m),
        r = new Cesium$c.Geometry({
          attributes: t,
          indices: p,
          primitiveType: Cesium$c.PrimitiveType.TRIANGLES,
          boundingSphere: i,
        });
      return computeVertexNormals(r), (m = []), (p = []), r;
    }),
    (CylinderGeometry.createOutlineGeometry = function (t) {
      var e = t.length,
        i = t.topRadius,
        n = t.bottomRadius,
        r = t.slices,
        a = (2 * Math.PI) / (r - 1),
        l = [],
        h = [],
        d = [],
        m = [],
        f = [n, i],
        p = [0, t.zReverse ? -e : e],
        c = 0,
        t = Math.atan2(n - i, e),
        g = s$1;
      g.z = Math.sin(t);
      for (var v = Math.cos(t), y = 0; y < p.length; y++) {
        m[y] = [];
        for (var C = f[y], w = 0; w < r; w++) {
          m[y].push(c++);
          var x = a * w,
            A = C * Math.cos(x),
            b = C * Math.sin(x);
          l.push(A, b, p[y]),
            (A = v * Math.cos(x)),
            (b = v * Math.sin(x)),
            h.push(A, b, g.z),
            d.push(y / (p.length - 1), 0);
        }
      }
      for (var M = [], y = 1; y < p.length; y++)
        for (w = 1; w < r; w += 1) {
          var P = m[y - 1][w - 1],
            S = m[y][w - 1];
          m[y][w], m[y - 1][w], w % 8 == 1 && M.push(P, S);
        }
      (M = new Int16Array(M)),
        (l = new Float32Array(l)),
        (h = new Float32Array(h)),
        (d = new Float32Array(d)),
        (n = {
          position: new Cesium$c.GeometryAttribute({
            componentDatatype: Cesium$c.ComponentDatatype.DOUBLE,
            componentsPerAttribute: 3,
            values: l,
          }),
          normal: new Cesium$c.GeometryAttribute({
            componentDatatype: Cesium$c.ComponentDatatype.FLOAT,
            componentsPerAttribute: 3,
            values: h,
          }),
          st: new Cesium$c.GeometryAttribute({
            componentDatatype: Cesium$c.ComponentDatatype.FLOAT,
            componentsPerAttribute: 2,
            values: d,
          }),
        }),
        (i = Cesium$c.BoundingSphere.fromVertices(l)),
        (e = new Cesium$c.Geometry({
          attributes: n,
          indices: M,
          primitiveType: Cesium$c.PrimitiveType.LINES,
          boundingSphere: i,
        }));
      return (l = []), (M = []), (d = []), e;
    }),
    (CylinderGeometry.fromAngleAndLength = function (t, e, i) {
      return (
        (t = Cesium$c.Math.toRadians(t)),
        new n({
          topRadius: (Math.tan(t) * e) / 2,
          bottomRadius: 0,
          length: e,
          zReverse: i,
        })
      );
    }),
    window.Cesium),
  CylinderRadarPrimitive = (function () {
    function CylinderRadarPrimitive(viewer, opt) {
      _classCallCheck(this, CylinderRadarPrimitive),
        (this.viewer = viewer),
        (this.opt = opt || {}),
        (this._geometry = void 0),
        90 < this.opt.angle && (this.opt.angle = 89.9),
        this.opt.angle < 0 && (this.opt.angle = 0.1),
        (this._angle = 90 - this.opt.angle),
        (this._radius = this.opt.radius || 5),
        (this._position = this.opt.position),
        (this._rotation = this.opt.rotation || {
          heading: 0,
          pitch: 0,
          roll: 0,
        }),
        (this._color = this.opt.color || Cesium$d.Color.YELLOW),
        (this._lineColor = this.opt.lineColor || Cesium$d.Color.WHITE),
        (this._visible = Cesium$d.defaultValue(this.opt.visible, !0)),
        (this._outline = Cesium$d.defaultValue(this.opt.outline, !0)),
        (this._topVisible = Cesium$d.defaultValue(this.opt.topVisible, !0)),
        (this._topOutline = Cesium$d.defaultValue(this.opt.topOutline, !0)),
        (this._modelMatrix = Cesium$d.Matrix4.clone(Cesium$d.Matrix4.IDENTITY)),
        (this._quaternion = new Cesium$d.Quaternion()),
        (this._translation = new Cesium$d.Cartesian3()),
        (this._scale = new Cesium$d.Cartesian3(1, 1, 1)),
        (this._matrix = new Cesium$d.Matrix4()),
        (this._inverseMatrix = new Cesium$d.Matrix4()),
        (this._positionCartographic = new Cesium$d.Cartographic()),
        (this._positionCartesian = null),
        (this._drawCommands = []),
        this.updateGeometry();
    }
    return (
      _createClass(CylinderRadarPrimitive, [
        {
          key: "color",
          get: function () {
            return this._color;
          },
          set: function (color) {
            this._color = color;
          },
        },
        {
          key: "lineColor",
          get: function () {
            return this._lineColor;
          },
          set: function (color) {
            this._lineColor = color;
          },
        },
        {
          key: "position",
          get: function () {
            return this._position;
          },
          set: function (position) {
            this._position = position.clone();
          },
        },
        {
          key: "visible",
          get: function () {
            return this._visible;
          },
          set: function (visible) {
            this._visible = visible;
          },
        },
        {
          key: "topVisible",
          get: function () {
            return this._topVisible;
          },
          set: function (visible) {
            this._topVisible = visible;
          },
        },
        {
          key: "angle",
          get: function () {
            return this._angle;
          },
          set: function (angle) {
            this._angle = 90 - angle <= 0 ? 0.1 : 90 - angle;
          },
        },
        {
          key: "topOutline",
          get: function () {
            return this._topOutline;
          },
          set: function (topOutline) {
            this._topOutline = topOutline;
          },
        },
        {
          key: "radius",
          get: function () {
            return this._radius;
          },
          set: function (radius) {
            return (this._radius = radius);
          },
        },
        {
          key: "computeMatrix",
          value: function (t, e) {
            var i;
            return (
              this._positionCartesian ||
                (this._positionCartesian = new Cesium$d.Cartesian3()),
              this.position instanceof Cesium$d.Cartesian3
                ? (this._positionCartesian = this.position)
                : "function" == typeof this.position.getValue
                ? (this._positionCartesian = this.position.getValue(t))
                : this.position._value &&
                  this.position._value instanceof Cesium$d.Cartesian3 &&
                  (this._positionCartesian = this.position._value),
              this._trackedEntity &&
                this._trackedEntity.position &&
                ((i = this._positionCartesian),
                (t = Cesium$d.Property.getValueOrUndefined(
                  this._trackedEntity.position,
                  t,
                  l
                )) &&
                  ((this._trackedEntityPosition = t),
                  (i = radarSpace.matrix.getHeadingPitchRollForLine(
                    i,
                    t,
                    this.viewer.scene.globe.ellipsoid
                  )),
                  (this._rotation.heading = i.heading),
                  (this._rotation.pitch = i.pitch),
                  (this._rotation.roll = i.roll))),
              (this._modelMatrix = Cesium$d.Transforms.eastNorthUpToFixedFrame(
                this._positionCartesian,
                this.viewer.scene.globe.ellipsoid,
                this._modelMatrix
              )),
              (this._positionCartographic = Cesium$d.Cartographic.fromCartesian(
                this._positionCartesian,
                this.viewer.scene.globe.ellipsoid,
                this._positionCartographic
              )),
              Cesium$d.Transforms.eastNorthUpToFixedFrame(
                this._positionCartesian,
                this.viewer.scene.globe.ellipsoid,
                this._modelMatrix
              ),
              Cesium$d.Quaternion.fromHeadingPitchRoll(
                this._rotation,
                this._quaternion
              ),
              (this._matrix =
                Cesium$d.Matrix4.fromTranslationQuaternionRotationScale(
                  this._translation,
                  this._quaternion,
                  this._scale,
                  this._matrix
                )),
              Cesium$d.Matrix4.multiplyTransformation(
                this._modelMatrix,
                this._matrix,
                this._matrix
              ),
              Cesium$d.Matrix4.inverseTransformation(
                this._matrix,
                this._inverseMatrix
              ),
              this._matrix
            );
          },
        },
        {
          key: "getTopGeometry",
          value: function () {
            for (
              var t = this.radius,
                e = [],
                i = [],
                n = [],
                r = [],
                o = 90 - parseInt(this.angle),
                s = o < 1 ? o / 8 : 1,
                l = (2 * Math.PI) / 127,
                h = 0,
                d = this.angle;
              d < 91;
              d += s
            ) {
              for (
                var m = Cesium$d.Math.toRadians(d < 90 ? d : 90),
                  m = Math.cos(m) * t,
                  f = [],
                  p = 0;
                p < 128;
                p++
              ) {
                var c = l * p,
                  _ = m * Math.cos(c),
                  c = m * Math.sin(c),
                  v = Math.sqrt(t * t - _ * _ - c * c);
                e.push(_, c, v), i.push(1, 1), f.push(h++);
              }
              r.push(f);
            }
            for (d = 1; d < r.length; d++)
              for (p = 1; p < r[d].length; p++) {
                var y = r[d - 1][p - 1],
                  C = r[d][p - 1],
                  w = r[d][p],
                  x = r[d - 1][p];
                n.push(y, C, w), n.push(y, w, x);
              }
            var e = new Float32Array(e),
              n = new Int32Array(n),
              i = new Float32Array(i),
              o = {
                position: new Cesium$d.GeometryAttribute({
                  componentDatatype: Cesium$d.ComponentDatatype.DOUBLE,
                  componentsPerAttribute: 3,
                  values: e,
                }),
                st: new Cesium$d.GeometryAttribute({
                  componentDatatype: Cesium$d.ComponentDatatype.FLOAT,
                  componentsPerAttribute: 2,
                  values: i,
                }),
              },
              b = Cesium$d.BoundingSphere.fromVertices(e),
              o = new Cesium$d.Geometry({
                attributes: o,
                indices: n,
                primitiveType: Cesium$d.PrimitiveType.TRIANGLES,
                boundingSphere: b,
              });
            return (0, this.computeVertexNormals)(o), o;
          },
        },
        {
          key: "getTopOutlineGeometry",
          value: function () {
            for (
              var t = this.radius,
                e = [],
                i = [],
                n = [],
                r = [],
                o = 90 - parseInt(this.angle),
                s = o < 1 ? o / 8 : 1,
                l = (2 * Math.PI) / 127,
                h = 0,
                d = this.angle;
              d < 91;
              d += s
            ) {
              for (
                var m = Cesium$d.Math.toRadians(d < 90 ? d : 90),
                  m = Math.cos(m) * t,
                  f = [],
                  p = 0;
                p < 128;
                p++
              ) {
                var c = l * p,
                  _ = m * Math.cos(c),
                  c = m * Math.sin(c),
                  v = Math.sqrt(t * t - _ * _ - c * c);
                e.push(_, c, v), i.push(1, 1), f.push(h++);
              }
              r.push(f);
            }
            for (d = 1; d < r.length; d++)
              for (p = 1; p < r[d].length; p++) {
                var y = r[d - 1][p - 1],
                  C = r[d][p - 1],
                  w = r[d][p];
                r[d - 1][p],
                  p % 8 == 1 && n.push(y, C),
                  d % 8 == 1 && n.push(C, w);
              }
            var e = new Float32Array(e),
              n = new Int32Array(n),
              i = new Float32Array(i),
              o = {
                position: new Cesium$d.GeometryAttribute({
                  componentDatatype: Cesium$d.ComponentDatatype.DOUBLE,
                  componentsPerAttribute: 3,
                  values: e,
                }),
                st: new Cesium$d.GeometryAttribute({
                  componentDatatype: Cesium$d.ComponentDatatype.FLOAT,
                  componentsPerAttribute: 2,
                  values: i,
                }),
              },
              A = Cesium$d.BoundingSphere.fromVertices(e),
              o = new Cesium$d.Geometry({
                attributes: o,
                indices: n,
                primitiveType: Cesium$d.PrimitiveType.LINES,
                boundingSphere: A,
              });
            return (0, this.computeVertexNormals)(o), o;
          },
        },
        {
          key: "updateGeometry",
          value: function () {
            (this._geometry = CylinderGeometry.createGeometry(
              new CylinderGeometry({
                topRadius:
                  this._radius * Math.cos(Cesium$d.Math.toRadians(this.angle)),
                bottomRadius: 0,
                length:
                  this._radius * Math.sin(Cesium$d.Math.toRadians(this.angle)),
              })
            )),
              (this._topGeometry = this.getTopGeometry()),
              (this._topOutlineGeometry = this.getTopOutlineGeometry()),
              (this._outlineGeometry = CylinderGeometry.createOutlineGeometry(
                new CylinderGeometry({
                  topRadius:
                    this._radius *
                    Math.cos(Cesium$d.Math.toRadians(this.angle)),
                  bottomRadius: 0,
                  slices: 128,
                  length:
                    this._radius *
                    Math.sin(Cesium$d.Math.toRadians(this.angle)),
                })
              )),
              (this._positions = new Float32Array(
                this._geometry.attributes.position.values.length
              ));
            for (var t = 0; t < this._positions.length; t++)
              this._positions[t] = this._geometry.attributes.position.values[t];
            this._drawCommands &&
              this._drawCommands.length &&
              (this._drawCommands.forEach(function (t) {
                t.vertexArray = t.vertexArray && t.vertexArray.destroy();
              }),
              this._drawCommands.splice(0, this._drawCommands.length));
          },
        },
        {
          key: "update",
          value: function (t) {
            this._visible &&
              (this.updateGeometry(),
              this.computeMatrix(t.time),
              (this._geometry.boundingSphere =
                Cesium$d.BoundingSphere.fromVertices(
                  this._geometry.attributes.position.values
                )),
              0 == this._drawCommands.length &&
                (this._drawCommands.push(
                  this.createDrawCommand(this._geometry, t)
                ),
                this._outline &&
                  this._drawCommands.push(
                    this.createDrawCommand(this._outlineGeometry, t)
                  ),
                this._topVisible &&
                  (this._drawCommands.push(
                    this.createDrawCommand(this._topGeometry, t)
                  ),
                  this._topOutline &&
                    this._drawCommands.push(
                      this.createDrawCommand(this._topOutlineGeometry, t)
                    ))),
              this._drawCommands.forEach(function (e) {
                t.commandList.push(e);
              }));
          },
        },
        {
          key: "destroyCommands",
          value: function () {
            this._drawCommands &&
              this._drawCommands.forEach(function (t) {
                Cesium$d.defined(t.command) &&
                  ((t.command.shaderProgram =
                    t.command.shaderProgram &&
                    t.command.shaderProgram.destroy()),
                  (t.command.vertexArray =
                    t.command.vertexArray && t.command.vertexArray.destroy()),
                  (t.command = void 0));
              }),
              this._drawCommands && (this._drawCommands.length = 0);
          },
        },
        {
          key: "getFragmentShaderSource",
          value: function (t) {
            return "\n\n        in vec3 v_position;\n\n        in vec3 v_normal;\n\n        uniform float picked;\n\n        uniform vec4  pickedColor;\n\n        uniform vec4  defaultColor;\n\n        uniform float specular;\n\n        uniform float shininess;\n\n        uniform vec3  emission;\n\n        in vec2 v_st;\n\n        uniform bool isLine;\n\n        uniform float glowPower;\n\n        void main() {\n    vec3 positionToEyeEC = -v_position; \n    vec3 normalEC =normalize(v_normal);\n    vec4 color=defaultColor;\n    if(picked!=0.0){\n        color = pickedColor;\n    }\n    //if(v_st.x<0.5){\n    //    color.a =0.75-v_st.x; \n    //}\n    //else  {\n    //    color.a =v_st.x-0.25; \n    //}\n    czm_material material;\n    material.specular = specular;\n    material.shininess = shininess;\n    material.normal =  normalEC;\n    material.emission =emission;//vec3(0.2,0.2,0.2);\n    material.diffuse = color.rgb ;\n    if(isLine){\n        material.alpha = 1.0; \n    }\n    else{\n        material.alpha =  color.a; \n    }\n        //float glow = glowPower / abs(v_st.t  ) - (glowPower / 0.5); \n        // \n        //material.emission = max(vec3(glow - 1.0 + color.rgb), color.rgb); \n        //if(isLine)\n        //    material.alpha = clamp(0.0, 1.0, glow) * color.a; \n         \n    \n        if(v_st.x==0.0){ \n          \n            out_FragColor = color ;\n    \n        }else { \n        \n            out_FragColor =color ;\n \n            // gl_FragColor = czm_phong(normalize(positionToEyeEC), material) ; \n    \n        } \n        \n}";
          },
        },
        {
          key: "getVertexShaderSource",
          value: function (t) {
            return "\n#ifdef GL_ES\n    precision highp float;\n\n        #endif\n\n\n        in vec3 position;\n\n        in vec2 st;\n\n        in vec3 normal;\n\n        uniform mat4 modelViewMatrix;\n\n        uniform mat3 normalMatrix;\n\n        uniform mat4 projectionMatrix;\n\n        out vec3 v_position;\n\n        out vec3 v_normal;\n\n        out vec2 v_st;\n\n\n        out vec3 v_light0Direction;\n\n\n        void main(void) \n{\n    vec4 pos =  modelViewMatrix * vec4( position,1.0);\n    v_normal =  normalMatrix *  normal;\n    v_st = st;\n    v_position = pos.xyz;\n    v_light0Direction = mat3( modelViewMatrix) * vec3(1.0,1.0,1.0);\n    gl_Position =  projectionMatrix * pos;\n}";
          },
        },
        {
          key: "createDrawCommand",
          value: function (t, e, i) {
            var that = this,
              n = e.context,
              r = new Cesium$d.Cartesian3(),
              r =
                (Cesium$d.Matrix4.multiplyByPoint(
                  this._matrix,
                  t.boundingSphere.center,
                  r
                ),
                new Cesium$d.BoundingSphere(r, t.boundingSphere.radius)),
              i = new Cesium$d.DrawCommand({
                modelMatrix: i || this._matrix,
                owner: this,
                primitiveType: t.primitiveType,
                pass: Cesium$d.Pass.TRANSLUCENT,
                boundingVolume: r,
              }),
              u = this,
              r = Cesium$d.GeometryPipeline.createAttributeLocations(t);
            return (
              (i.vertexArray = Cesium$d.VertexArray.fromGeometry({
                context: n,
                geometry: t,
                attributeLocations: r,
                bufferUsage: Cesium$d.BufferUsage.STATIC_DRAW,
              })),
              (i.vertexArray._attributeLocations = r),
              (i.shaderProgram = Cesium$d.ShaderProgram.replaceCache({
                context: n,
                vertexShaderSource: this.getVertexShaderSource(t),
                fragmentShaderSource: this.getFragmentShaderSource(t),
                attributeLocations: r,
              })),
              (i.renderState = Cesium$d.RenderState.fromCache({
                blending: Cesium$d.BlendingState.ALPHA_BLEND,
                depthTest: { enabled: !0, func: Cesium$d.DepthFunction.LESS },
                cull: { enabled: !1, face: Cesium$d.CullFace.BACK },
              })),
              (i.uniformMap = {}),
              (i.uniformMap.projectionMatrix = function () {
                return e.context.uniformState.projection;
              }),
              (i.uniformMap.modelViewMatrix = function () {
                return e.context.uniformState.modelView;
              }),
              (i.uniformMap.shininess = function () {
                return u.shininess || (u.shininess = 0), u.shininess;
              }),
              (i.uniformMap.emission = function () {
                return (
                  u.emission ||
                    (u.emission = new Cesium$d.Cartesian3(0.2, 0.2, 0.2)),
                  u.emission
                );
              }),
              (i.uniformMap.specular = function () {
                return u.specular || (u.specular = 0), u.specular;
              }),
              (i.uniformMap.isLine = function () {
                return (
                  t.primitiveType == Cesium$d.PrimitiveType.LINES ||
                  t.primitiveType == Cesium$d.PrimitiveType.LINE_STRIP
                );
              }),
              (i.uniformMap.defaultColor = function () {
                Cesium$d.Color.BLUE;
                return t.primitiveType == Cesium$d.PrimitiveType.LINES
                  ? that._lineColor
                  : that._color;
              }),
              (i.uniformMap.picked = function () {
                return u.picked || (u.picked = 0), u.picked;
              }),
              (i.uniformMap.pickedColor = function () {
                return (
                  u.pickedColor ||
                    (u.pickedColor = new Cesium$d.Color(1, 1, 0, 1)),
                  u.pickedColor
                );
              }),
              (i.uniformMap.normalMatrix = function () {
                return e.context.uniformState.normal;
              }),
              (i.uniformMap.glowPower = function () {
                return 0.25;
              }),
              i
            );
          },
        },
        {
          key: "destroy",
          value: function (t) {
            t &&
              (this.viewer.scene.primitives.remove(this),
              this._drawCommands.forEach(function (t) {
                t.vertexArray = t.vertexArray && t.vertexArray.destroy();
              }),
              (this._drawCommands = []));
          },
        },
        {
          key: "getNormal",
          value: function (t) {
            for (
              var e, i, n, r, o = t.attributes.normal.values, a = 0;
              a < o.length;
              a += 3
            )
              (e = o[a]),
                (i = o[a + 1]),
                (n = o[a + 2]),
                (r = 1 / Math.sqrt(e * e + i * i + n * n)),
                (o[a] = e * r),
                (o[a + 1] = i * r),
                (o[a + 2] = n * r);
          },
        },
        {
          key: "computeVertexNormals",
          value: function (t) {
            var e = t.indices,
              i = t.attributes,
              n = e.length;
            if (i.position) {
              var o = i.position.values;
              if (void 0 === i.normal)
                i.normal = new Cesium$d.GeometryAttribute({
                  componentDatatype: Cesium$d.ComponentDatatype.FLOAT,
                  componentsPerAttribute: 3,
                  values: new Float32Array(o.length),
                });
              else for (var a = i.normal.values, s = 0; s < n; s++) a[s] = 0;
              for (
                var u,
                  l,
                  h,
                  d = i.normal.values,
                  m = new Cesium$d.Cartesian3(),
                  f = new Cesium$d.Cartesian3(),
                  p = new Cesium$d.Cartesian3(),
                  c = new Cesium$d.Cartesian3(),
                  _ = new Cesium$d.Cartesian3(),
                  s = 0;
                s < n;
                s += 3
              )
                (u = 3 * e[s + 0]),
                  (l = 3 * e[s + 1]),
                  (h = 3 * e[s + 2]),
                  Cesium$d.Cartesian3.fromArray(o, u, m),
                  Cesium$d.Cartesian3.fromArray(o, l, f),
                  Cesium$d.Cartesian3.fromArray(o, h, p),
                  Cesium$d.Cartesian3.subtract(p, f, c),
                  Cesium$d.Cartesian3.subtract(m, f, _),
                  Cesium$d.Cartesian3.cross(c, _, c),
                  (d[u] += c.x),
                  (d[1 + u] += c.y),
                  (d[2 + u] += c.z),
                  (d[l] += c.x),
                  (d[1 + l] += c.y),
                  (d[2 + l] += c.z),
                  (d[h] += c.x),
                  (d[1 + h] += c.y),
                  (d[2 + h] += c.z);
              for (
                var ii, r, o = t.attributes.normal.values, a = 0;
                a < o.length;
                a += 3
              )
                (e = o[a]),
                  (ii = o[a + 1]),
                  (n = o[a + 2]),
                  (r = 1 / Math.sqrt(e * e + ii * ii + n * n)),
                  (o[a] = e * r),
                  (o[a + 1] = ii * r),
                  (o[a + 2] = n * r);
              i.normal.needsUpdate = !0;
            }
            return t;
          },
        },
      ]),
      CylinderRadarPrimitive
    );
  })(),
  shader1 =
    '\n\t#ifdef GL_OES_standard_derivatives\n    \n\t#extension GL_OES_standard_derivatives : enable\n\n\t#endif\n\n\n\tuniform bool u_showIntersection;\n\n\tuniform bool u_showThroughEllipsoid;\n\n\n\tuniform float u_radius;\n\n\tuniform float u_xHalfAngle;\n\n\tuniform float u_yHalfAngle;\n\n\tuniform float u_normalDirection;\n\n\tuniform float u_type;\n\n\n\tin vec3 v_position;\n\n\tin vec3 v_positionWC;\n\n\tin vec3 v_positionEC;\n\n\tin vec3 v_normalEC;\n\n\n\tvec4 getColor(float sensorRadius, vec3 pointEC)\n\n\t{\n    czm_materialInput materialInput;\n\n    vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\n    materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\n    materialInput.str = pointMC / sensorRadius;\n\n    vec3 positionToEyeEC = -v_positionEC;\n    materialInput.positionToEyeEC = positionToEyeEC;\n\n    vec3 normalEC = normalize(v_normalEC);\n    materialInput.normalEC = u_normalDirection * normalEC;\n\n    czm_material material = czm_getMaterial(materialInput);\n    // czm_lightDirectionEC在cesium1.66开始加入的\n    return mix(czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC), vec4(material.diffuse, material.alpha), 0.4);\n\n}\n\nbool isOnBoundary(float value, float epsilon)\n{\n    float width = getIntersectionWidth();\n    float tolerance = width * epsilon;\n\n#ifdef GL_OES_standard_derivatives\n    float delta = max(abs(dFdx(value)), abs(dFdy(value)));\n    float pixels = width * delta;\n    float temp = abs(value);\n    // There are a couple things going on here.\n    // First we test the value at the current fragment to see if it is within the tolerance.\n    // We also want to check if the value of an adjacent pixel is within the tolerance,\n    // but we don\'t want to admit points that are obviously not on the surface.\n    // For example, if we are looking for "value" to be close to 0, but value is 1 and the adjacent value is 2,\n    // then the delta would be 1 and "temp - delta" would be "1 - 1" which is zero even though neither of\n    // the points is close to zero.\n    return temp < tolerance && temp < pixels || (delta < 10.0 * tolerance && temp - delta < tolerance && temp < pixels);\n#else\n    return abs(value) < tolerance;\n#endif\n}\n\nvec4 shade(bool isOnBoundary)\n{\n    if (u_showIntersection && isOnBoundary)\n    {\n        return getIntersectionColor();\n    }\n    if(u_type == 1.0){\n        return getLineColor();\n    }\n    return getColor(u_radius, v_positionEC);\n}\n\nfloat ellipsoidSurfaceFunction(vec3 point)\n{\n    vec3 scaled = czm_ellipsoidInverseRadii * point;\n    return dot(scaled, scaled) - 1.0;\n}\n\nvoid main()\n{\n    vec3 sensorVertexWC = czm_model[3].xyz;      // (0.0, 0.0, 0.0) in model coordinates\n    vec3 sensorVertexEC = czm_modelView[3].xyz;  // (0.0, 0.0, 0.0) in model coordinates\n\n    //vec3 pixDir = normalize(v_position);\n    float positionX = v_position.x;\n    float positionY = v_position.y;\n    float positionZ = v_position.z;\n\n    vec3 zDir = vec3(0.0, 0.0, 1.0);\n    vec3 lineX = vec3(positionX, 0 ,positionZ);\n    vec3 lineY = vec3(0, positionY, positionZ);\n    float resX = dot(normalize(lineX), zDir);\n    if(resX < cos(u_xHalfAngle)-0.00001){\n        discard;\n    }\n    float resY = dot(normalize(lineY), zDir);\n    if(resY < cos(u_yHalfAngle)-0.00001){\n        discard;\n    }\n\n\n    float ellipsoidValue = ellipsoidSurfaceFunction(v_positionWC);\n\n    // Occluded by the ellipsoid?\n\tif (!u_showThroughEllipsoid)\n\t{\n\t    // Discard if in the ellipsoid\n\t    // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done on the CPU first.\n\t    if (ellipsoidValue < 0.0)\n\t    {\n            discard;\n\t    }\n\n\t    // Discard if in the sensor\'s shadow\n\t    if (inSensorShadow(sensorVertexWC, v_positionWC))\n\t    {\n\t        discard;\n\t    }\n    }\n\n    // Notes: Each surface functions should have an associated tolerance based on the floating point error.\n    bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\n    //isOnEllipsoid = false;\n    //if((resX >= 0.8 && resX <= 0.81)||(resY >= 0.8 && resY <= 0.81)){\n    /*if(false){\n        out_FragColor = vec4(1.0,0.0,0.0,1.0);\n    }else{\n        out_FragColor = shade(isOnEllipsoid);\n    }\n*/\n    out_FragColor = shade(isOnEllipsoid);\n\n}\n',
  shader2 =
    "\n\tin vec4 position;\n\n\tin vec3 normal;\n\n\n\tout vec3 v_position;\n\n\tout vec3 v_positionWC;\n\n\tout vec3 v_positionEC;\n\n\tout vec3 v_normalEC;\n\n\n\tvoid main()\n{\n    gl_Position = czm_modelViewProjection * position;\n    v_position = vec3(position);\n    v_positionWC = (czm_model * position).xyz;\n    v_positionEC = (czm_modelView * position).xyz;\n    v_normalEC = czm_normal * normal;\n}\n\t",
  shader3 =
    "\nuniform vec4 u_intersectionColor;\n\nuniform float u_intersectionWidth;\n\nuniform vec4 u_lineColor;\n\n\nbool inSensorShadow(vec3 coneVertexWC, vec3 pointWC)\n{\n    // Diagonal matrix from the unscaled ellipsoid space to the scaled space.    \n    vec3 D = czm_ellipsoidInverseRadii;\n\n    // Sensor vertex in the scaled ellipsoid space\n    vec3 q = D * coneVertexWC;\n    float qMagnitudeSquared = dot(q, q);\n    float test = qMagnitudeSquared - 1.0;\n    \n    // Sensor vertex to fragment vector in the ellipsoid's scaled space\n    vec3 temp = D * pointWC - q;\n    float d = dot(temp, q);\n    \n    // Behind silhouette plane and inside silhouette cone\n    return (d < -test) && (d / length(temp) < -sqrt(test));\n}\n\n///////////////////////////////////////////////////////////////////////////////\n\nvec4 getLineColor()\n{\n    return u_lineColor;\n}\n\nvec4 getIntersectionColor()\n{\n    return u_intersectionColor;\n}\n\nfloat getIntersectionWidth()\n{\n    return u_intersectionWidth;\n}\n\nvec2 sensor2dTextureCoordinates(float sensorRadius, vec3 pointMC)\n{\n    // (s, t) both in the range [0, 1]\n    float t = pointMC.z / sensorRadius;\n    float s = 1.0 + (atan(pointMC.y, pointMC.x) / czm_twoPi);\n    s = s - floor(s);\n    \n    return vec2(s, t);\n}\n\n",
  shader4 =
    "\n\t#ifdef GL_OES_standard_derivatives\n\n    #extension GL_OES_standard_derivatives : enable\n#endif\n\n\n\tuniform bool u_showIntersection;\n\n\tuniform bool u_showThroughEllipsoid;\n\n\n\tuniform float u_radius;\n\n\tuniform float u_xHalfAngle;\n\n\tuniform float u_yHalfAngle;\n\n\tuniform float u_normalDirection;\n\n\tuniform vec4 u_color;\n\n\n\tin vec3 v_position;\n\n\tin vec3 v_positionWC;\n\n\tin vec3 v_positionEC;\n\n\tin vec3 v_normalEC;\n\n\n\tvec4 getColor(float sensorRadius, vec3 pointEC)\n{\n    \n\t\tczm_materialInput materialInput;\n\n    \n\t\tvec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;\n    \n\t\tmaterialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);\n    \n\t\tmaterialInput.str = pointMC / sensorRadius;\n\n    \n\t\tvec3 positionToEyeEC = -v_positionEC;\n    \n\t\tmaterialInput.positionToEyeEC = positionToEyeEC;\n\n    \n\t\tvec3 normalEC = normalize(v_normalEC);\n    \n\t\tmaterialInput.normalEC = u_normalDirection * normalEC;\n\n    \n\t\tczm_material material = czm_getMaterial(materialInput);\n\n    \n\t\tmaterial.diffuse = u_color.rgb;\n    \n\t\tmaterial.alpha = u_color.a;\n    \n\t\t// czm_lightDirectionEC在cesium1.66开始加入的\n    \n\t\treturn mix(czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC), vec4(material.diffuse, material.alpha), 0.4);\n\n}\n\n\n\t\tbool isOnBoundary(float value, float epsilon)\n{\n    \n\t\t\tfloat width = getIntersectionWidth();\n    \n\t\t\tfloat tolerance = width * epsilon;\n\n\n\t\t\t#ifdef GL_OES_standard_derivatives\n    \n\t\t\tfloat delta = max(abs(dFdx(value)), abs(dFdy(value)));\n    \n\t\t\tfloat pixels = width * delta;\n    \n\t\t\tfloat temp = abs(value);\n    \n\t\t\t\n\t\t\treturn temp < tolerance && temp < pixels || (delta < 10.0 * tolerance && temp - delta < tolerance && temp < pixels);\n\n\t\t\t#else\n \n\t\t\treturn abs(value) < tolerance;\n#endif\n}\n\n\n\t\t\tvec4 shade(bool isOnBoundary)\n{\n    \t\n\t\t\t\tif (u_showIntersection && isOnBoundary)\n    {\n        \n\t\t\t\t\treturn getIntersectionColor();\n    \n\t\t\t\t}\n    \n\t\t\t\treturn getColor(u_radius, v_positionEC);\n\n\t\t\t}\n\n\n\t\t\tfloat ellipsoidSurfaceFunction(vec3 point)\n{\n    \n\t\t\t\t\tvec3 scaled = czm_ellipsoidInverseRadii * point;\n    \n\t\t\t\t\treturn dot(scaled, scaled) - 1.0;\n}\n\n\n\t\t\t\t\tvoid main()\n{\n    \n\t\t\t\t\t\tvec3 sensorVertexWC = czm_model[3].xyz;      \n\t\t\t\t\t\t// (0.0, 0.0, 0.0) in model coordinates\n    \n\t\t\t\t\t\tvec3 sensorVertexEC = czm_modelView[3].xyz;  \n\t\t\t\t\t\t// (0.0, 0.0, 0.0) in model coordinates\n\n    \n\t\t\t\t\t\t//vec3 pixDir = normalize(v_position);\n    \n\t\t\t\t\t\tfloat positionX = v_position.x;\n    \n\t\t\t\t\t\tfloat positionY = v_position.y;\n    \n\t\t\t\t\t\tfloat positionZ = v_position.z;\n\n    \n\t\t\t\t\t\tvec3 zDir = vec3(0.0, 0.0, 1.0);\n    \n\t\t\t\t\t\tvec3 lineX = vec3(positionX, 0 ,positionZ);\n    \n\t\t\t\t\t\tvec3 lineY = vec3(0, positionY, positionZ);\n    \n\t\t\t\t\t\tfloat resX = dot(normalize(lineX), zDir);\n    \n\t\t\t\t\t\tif(resX < cos(u_xHalfAngle) - 0.0001){\n        \n\t\t\t\t\t\t\tdiscard;\n    \n\t\t\t\t\t\t}\n    \n\t\t\t\t\t\tfloat resY = dot(normalize(lineY), zDir);\n    \n\t\t\t\t\t\tif(resY < cos(u_yHalfAngle)- 0.0001){\n        \n\t\t\t\t\t\t\tdiscard;\n    \n\t\t\t\t\t\t}\n\n\n    \n\t\t\t\t\t\tfloat ellipsoidValue = ellipsoidSurfaceFunction(v_positionWC);\n\n    \n\t\t\t\t\t\tif (!u_showThroughEllipsoid)\n\t{\n\t    \n\t\t\t\t\t\t \n\t\t\t\t\t\tif (ellipsoidValue < 0.0)\n\t    {\n            \n\t\t\t\t\t\t\tdiscard;\n\t    }\n\n\t    \n\t\t\t\t\t\t\tif (inSensorShadow(sensorVertexWC, v_positionWC))\n\t    {\n\t        \n\t\t\t\t\t\t\t\tdiscard;\n\t    \n\t\t\t\t\t\t\t}\n    \n\t\t\t\t\t\t}\n\n    \n\t\t\t\t\t\t\n\t\t\t\t\t\tbool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);\n    \n\t\t\t\t\t\tout_FragColor = shade(isOnEllipsoid);\n\n\n\t\t\t}\n",
  Cesium$e = window.Cesium;
function removePrimitive(entity, hash, primitives) {
  var data = hash[entity.id];
  Cesium$e.defined(data) &&
    ((data = data.primitive),
    primitives.remove(data),
    data.isDestroyed() || data.destroy(),
    delete hash[entity.id]);
}
function ScanRadarGraphics(options) {
  (this._show = void 0),
    (this._radius = void 0),
    (this._xHalfAngle = void 0),
    (this._yHalfAngle = void 0),
    (this._lineColor = void 0),
    (this._showSectorLines = void 0),
    (this._showSectorSegmentLines = void 0),
    (this._showLateralSurfaces = void 0),
    (this._material = void 0),
    (this._showDomeSurfaces = void 0),
    (this._showDomeLines = void 0),
    (this._showIntersection = void 0),
    (this._intersectionColor = void 0),
    (this._intersectionWidth = void 0),
    (this._showThroughEllipsoid = void 0),
    (this._gaze = void 0),
    (this._showScanPlane = void 0),
    (this._scanPlaneColor = void 0),
    (this._scanPlaneMode = void 0),
    (this._scanPlaneRate = void 0),
    (this._definitionChanged = new Cesium$e.Event()),
    this.merge(
      Cesium$e.defaultValue(options, Cesium$e.defaultValue.EMPTY_OBJECT)
    );
}
Object.defineProperties(ScanRadarGraphics.prototype, {
  definitionChanged: {
    get: function () {
      return this._definitionChanged;
    },
  },
  show: Cesium$e.createPropertyDescriptor("show"),
  radius: Cesium$e.createPropertyDescriptor("radius"),
  xHalfAngle: Cesium$e.createPropertyDescriptor("xHalfAngle"),
  yHalfAngle: Cesium$e.createPropertyDescriptor("yHalfAngle"),
  lineColor: Cesium$e.createPropertyDescriptor("lineColor"),
  showSectorLines: Cesium$e.createPropertyDescriptor("showSectorLines"),
  showSectorSegmentLines: Cesium$e.createPropertyDescriptor(
    "showSectorSegmentLines"
  ),
  showLateralSurfaces: Cesium$e.createPropertyDescriptor("showLateralSurfaces"),
  material: Cesium$e.createMaterialPropertyDescriptor("material"),
  showDomeSurfaces: Cesium$e.createPropertyDescriptor("showDomeSurfaces"),
  showDomeLines: Cesium$e.createPropertyDescriptor("showDomeLines "),
  showIntersection: Cesium$e.createPropertyDescriptor("showIntersection"),
  intersectionColor: Cesium$e.createPropertyDescriptor("intersectionColor"),
  intersectionWidth: Cesium$e.createPropertyDescriptor("intersectionWidth"),
  showThroughEllipsoid: Cesium$e.createPropertyDescriptor(
    "showThroughEllipsoid"
  ),
  gaze: Cesium$e.createPropertyDescriptor("gaze"),
  showScanPlane: Cesium$e.createPropertyDescriptor("showScanPlane"),
  scanPlaneColor: Cesium$e.createPropertyDescriptor("scanPlaneColor"),
  scanPlaneMode: Cesium$e.createPropertyDescriptor("scanPlaneMode"),
  scanPlaneRate: Cesium$e.createPropertyDescriptor("scanPlaneRate"),
}),
  (ScanRadarGraphics.prototype.clone = function (result) {
    return (
      ((result = Cesium$e.defined(result)
        ? result
        : new ScanRadarGraphics()).show = this.show),
      (result.radius = this.radius),
      (result.xHalfAngle = this.xHalfAngle),
      (result.yHalfAngle = this.yHalfAngle),
      (result.lineColor = this.lineColor),
      (result.showSectorLines = this.showSectorLines),
      (result.showSectorSegmentLines = this.showSectorSegmentLines),
      (result.showLateralSurfaces = this.showLateralSurfaces),
      (result.material = this.material),
      (result.showDomeSurfaces = this.showDomeSurfaces),
      (result.showDomeLines = this.showDomeLines),
      (result.showIntersection = this.showIntersection),
      (result.intersectionColor = this.intersectionColor),
      (result.intersectionWidth = this.intersectionWidth),
      (result.showThroughEllipsoid = this.showThroughEllipsoid),
      (result.gaze = this.gaze),
      (result.showScanPlane = this.showScanPlane),
      (result.scanPlaneColor = this.scanPlaneColor),
      (result.scanPlaneMode = this.scanPlaneMode),
      (result.scanPlaneRate = this.scanPlaneRate),
      result
    );
  }),
  (ScanRadarGraphics.prototype.merge = function (source) {
    if (!Cesium$e.defined(source))
      throw new Cesium$e.DeveloperError("source is required.");
    (this.slice = Cesium$e.defaultValue(this.slice, source.slice)),
      (this.show = Cesium$e.defaultValue(this.show, source.show)),
      (this.radius = Cesium$e.defaultValue(this.radius, source.radius)),
      (this.xHalfAngle = Cesium$e.defaultValue(
        this.xHalfAngle,
        source.xHalfAngle
      )),
      (this.yHalfAngle = Cesium$e.defaultValue(
        this.yHalfAngle,
        source.yHalfAngle
      )),
      (this.lineColor = Cesium$e.defaultValue(
        this.lineColor,
        source.lineColor
      )),
      (this.showSectorLines = Cesium$e.defaultValue(
        this.showSectorLines,
        source.showSectorLines
      )),
      (this.showSectorSegmentLines = Cesium$e.defaultValue(
        this.showSectorSegmentLines,
        source.showSectorSegmentLines
      )),
      (this.showLateralSurfaces = Cesium$e.defaultValue(
        this.showLateralSurfaces,
        source.showLateralSurfaces
      )),
      (this.material = Cesium$e.defaultValue(this.material, source.material)),
      (this.showDomeSurfaces = Cesium$e.defaultValue(
        this.showDomeSurfaces,
        source.showDomeSurfaces
      )),
      (this.showDomeLines = Cesium$e.defaultValue(
        this.showDomeLines,
        source.showDomeLines
      )),
      (this.showIntersection = Cesium$e.defaultValue(
        this.showIntersection,
        source.showIntersection
      )),
      (this.intersectionColor = Cesium$e.defaultValue(
        this.intersectionColor,
        source.intersectionColor
      )),
      (this.intersectionWidth = Cesium$e.defaultValue(
        this.intersectionWidth,
        source.intersectionWidth
      )),
      (this.showThroughEllipsoid = Cesium$e.defaultValue(
        this.showThroughEllipsoid,
        source.showThroughEllipsoid
      )),
      (this.gaze = Cesium$e.defaultValue(this.gaze, source.gaze)),
      (this.showScanPlane = Cesium$e.defaultValue(
        this.showScanPlane,
        source.showScanPlane
      )),
      (this.scanPlaneColor = Cesium$e.defaultValue(
        this.scanPlaneColor,
        source.scanPlaneColor
      )),
      (this.scanPlaneMode = Cesium$e.defaultValue(
        this.scanPlaneMode,
        source.scanPlaneMode
      )),
      (this.scanPlaneRate = Cesium$e.defaultValue(
        this.scanPlaneRate,
        source.scanPlaneRate
      ));
  });
var AssociativeArray = Cesium$e.AssociativeArray,
  Cartesian3$3 = Cesium$e.Cartesian3,
  Color = Cesium$e.Color,
  defined$7 = Cesium$e.defined,
  destroyObject = Cesium$e.destroyObject,
  DeveloperError$3 = Cesium$e.DeveloperError,
  Matrix3 = Cesium$e.Matrix3,
  Matrix4$1 = Cesium$e.Matrix4,
  Quaternion = Cesium$e.Quaternion,
  MaterialProperty = Cesium$e.MaterialProperty,
  Property$1 = Cesium$e.Property,
  matrix3Scratch = new Matrix3(),
  cachedPosition = new Cartesian3$3(),
  cachedGazePosition = new Cartesian3$3(),
  cachedOrientation = new Quaternion(),
  diffVectorScratch = new Cartesian3$3(),
  orientationScratch = new Quaternion(),
  ScanRadarVisualizer = function ScanRadarVisualizer(scene, entityCollection) {
    if (!defined$7(scene)) throw new DeveloperError$3("scene is required.");
    if (!defined$7(entityCollection))
      throw new DeveloperError$3("entityCollection is required.");
    entityCollection.collectionChanged.addEventListener(
      ScanRadarVisualizer.prototype._onCollectionChanged,
      this
    ),
      (this._scene = scene),
      (this._primitives = scene.primitives),
      (this._entityCollection = entityCollection),
      (this._hash = {}),
      (this._entitiesToVisualize = new AssociativeArray()),
      this._onCollectionChanged(
        entityCollection,
        entityCollection.values,
        [],
        []
      );
  },
  BoundingSphere$1 =
    ((ScanRadarVisualizer.prototype.update = function (time) {
      if (!defined$7(time)) throw new DeveloperError$3("time is required.");
      for (
        var entities = this._entitiesToVisualize.values,
          hash = this._hash,
          primitives = this._primitives,
          i = 0,
          len = entities.length;
        i < len;
        i++
      ) {
        var position,
          xHalfAngle,
          yHalfAngle,
          entity = entities[i],
          rectangularSensorGraphics = entity._rectangularSensor,
          data = hash[entity.id],
          show =
            entity.isShowing &&
            entity.isAvailable(time) &&
            Property$1.getValueOrDefault(
              rectangularSensorGraphics._show,
              time,
              !0
            );
        if (
          (show &&
            ((position = Property$1.getValueOrUndefined(
              entity._position,
              time,
              cachedPosition
            )),
            (orientation = Property$1.getValueOrUndefined(
              entity._orientation,
              time,
              cachedOrientation
            )),
            (radius = Property$1.getValueOrUndefined(
              rectangularSensorGraphics._radius,
              time
            )),
            (xHalfAngle = Property$1.getValueOrUndefined(
              rectangularSensorGraphics._xHalfAngle,
              time
            )),
            (yHalfAngle = Property$1.getValueOrUndefined(
              rectangularSensorGraphics._yHalfAngle,
              time
            )),
            (show =
              defined$7(position) &&
              defined$7(xHalfAngle) &&
              defined$7(yHalfAngle))),
          show)
        ) {
          (show = defined$7(data) ? data.primitive : void 0),
            (entity =
              (defined$7(show) ||
                (((show = new ScanRadarPrimitive()).id = entity),
                primitives.add(show),
                (hash[entity.id] = data =
                  { primitive: show, position: void 0, orientation: void 0 })),
              Property$1.getValueOrUndefined(
                rectangularSensorGraphics._gaze,
                time
              )));
          if (defined$7(entity)) {
            var targetPosition = Property$1.getValueOrUndefined(
              entity._position,
              time,
              cachedGazePosition
            );
            if (!defined$7(position) || !defined$7(targetPosition)) continue;
            var diffVector = Cartesian3$3.subtract(
                position,
                targetPosition,
                diffVectorScratch
              ),
              rotate = Cartesian3$3.angleBetween(
                Cesium$e.Cartesian3.UNIT_Z,
                diffVector
              ),
              diffVector = Cartesian3$3.cross(
                Cesium$e.Cartesian3.UNIT_Z,
                diffVector,
                diffVectorScratch
              ),
              orientation = Quaternion.fromAxisAngle(
                diffVector,
                rotate - Math.PI,
                orientationScratch
              ),
              radius = Cartesian3$3.distance(position, targetPosition);
            show.modelMatrix = Matrix4$1.fromRotationTranslation(
              Matrix3.fromQuaternion(orientation, matrix3Scratch),
              position,
              show.modelMatrix
            );
          } else
            (Cartesian3$3.equals(position, data.position) &&
              Quaternion.equals(orientation, data.orientation)) ||
              (defined$7(orientation)
                ? ((show.modelMatrix = Matrix4$1.fromRotationTranslation(
                    Matrix3.fromQuaternion(orientation, matrix3Scratch),
                    position,
                    show.modelMatrix
                  )),
                  (data.position = Cartesian3$3.clone(position, data.position)),
                  (data.orientation = Quaternion.clone(
                    orientation,
                    data.orientation
                  )))
                : ((show.modelMatrix =
                    Cesium$e.Transforms.eastNorthUpToFixedFrame(position)),
                  (data.position = Cartesian3$3.clone(
                    position,
                    data.position
                  ))));
          (show.show = !0),
            (show.gaze = entity),
            (show.radius = radius),
            (show.xHalfAngle = xHalfAngle),
            (show.yHalfAngle = yHalfAngle),
            (show.lineColor = Property$1.getValueOrDefault(
              rectangularSensorGraphics._lineColor,
              time,
              Color.WHITE
            )),
            (show.showSectorLines = Property$1.getValueOrDefault(
              rectangularSensorGraphics._showSectorLines,
              time,
              !0
            )),
            (show.showSectorSegmentLines = Property$1.getValueOrDefault(
              rectangularSensorGraphics._showSectorSegmentLines,
              time,
              !0
            )),
            (show.showLateralSurfaces = Property$1.getValueOrDefault(
              rectangularSensorGraphics._showLateralSurfaces,
              time,
              !0
            )),
            (show.material = MaterialProperty.getValue(
              time,
              rectangularSensorGraphics._material,
              show.material
            )),
            (show.showDomeSurfaces = Property$1.getValueOrDefault(
              rectangularSensorGraphics._showDomeSurfaces,
              time,
              !0
            )),
            (show.showDomeLines = Property$1.getValueOrDefault(
              rectangularSensorGraphics._showDomeLines,
              time,
              !0
            )),
            (show.showIntersection = Property$1.getValueOrDefault(
              rectangularSensorGraphics._showIntersection,
              time,
              !0
            )),
            (show.intersectionColor = Property$1.getValueOrDefault(
              rectangularSensorGraphics._intersectionColor,
              time,
              Color.WHITE
            )),
            (show.intersectionWidth = Property$1.getValueOrDefault(
              rectangularSensorGraphics._intersectionWidth,
              time,
              1
            )),
            (show.showThroughEllipsoid = Property$1.getValueOrDefault(
              rectangularSensorGraphics._showThroughEllipsoid,
              time,
              !0
            )),
            (show.scanPlaneMode = Property$1.getValueOrDefault(
              rectangularSensorGraphics._scanPlaneMode,
              time
            )),
            (show.scanPlaneColor = Property$1.getValueOrDefault(
              rectangularSensorGraphics._scanPlaneColor,
              time,
              Color.WHITE
            )),
            (show.showScanPlane = Property$1.getValueOrDefault(
              rectangularSensorGraphics._showScanPlane,
              time,
              !0
            )),
            (show.scanPlaneRate = Property$1.getValueOrDefault(
              rectangularSensorGraphics._scanPlaneRate,
              time,
              1
            ));
        } else defined$7(data) && (data.primitive.show = !1);
      }
      return !0;
    }),
    (ScanRadarVisualizer.prototype.isDestroyed = function () {
      return !1;
    }),
    (ScanRadarVisualizer.prototype.destroy = function () {
      for (
        var entities = this._entitiesToVisualize.values,
          hash = this._hash,
          primitives = this._primitives,
          i = entities.length - 1;
        -1 < i;
        i--
      )
        removePrimitive(entities[i], hash, primitives);
      return destroyObject(this);
    }),
    (ScanRadarVisualizer.prototype._onCollectionChanged = function (
      entityCollection,
      added,
      removed,
      changed
    ) {
      for (
        var entity,
          entities = this._entitiesToVisualize,
          hash = this._hash,
          primitives = this._primitives,
          i = added.length - 1;
        -1 < i;
        i--
      )
        (entity = added[i]),
          defined$7(entity._rectangularSensor) &&
            defined$7(entity._position) &&
            entities.set(entity.id, entity);
      for (i = changed.length - 1; -1 < i; i--)
        (entity = changed[i]),
          defined$7(entity._rectangularSensor) && defined$7(entity._position)
            ? entities.set(entity.id, entity)
            : (removePrimitive(entity, hash, primitives),
              entities.remove(entity.id));
      for (i = removed.length - 1; -1 < i; i--)
        removePrimitive((entity = removed[i]), hash, primitives),
          entities.remove(entity.id);
    }),
    Cesium$e.BoundingSphere),
  Cartesian3$3 = Cesium$e.Cartesian3,
  Color = Cesium$e.Color,
  combine = Cesium$e.combine,
  ComponentDatatype = Cesium$e.ComponentDatatype,
  defaultValue = Cesium$e.defaultValue,
  defined$7 = Cesium$e.defined,
  DeveloperError$3 = Cesium$e.DeveloperError,
  Matrix4$1 = Cesium$e.Matrix4,
  PrimitiveType = Cesium$e.PrimitiveType,
  Buffer = Cesium$e.Buffer,
  BufferUsage = Cesium$e.BufferUsage,
  DrawCommand = Cesium$e.DrawCommand,
  Pass = Cesium$e.Pass,
  RenderState = Cesium$e.RenderState,
  ShaderProgram = Cesium$e.ShaderProgram,
  ShaderSource = Cesium$e.ShaderSource,
  VertexArray = Cesium$e.VertexArray,
  BlendingState = Cesium$e.BlendingState,
  CullFace = Cesium$e.CullFace,
  Material = Cesium$e.Material,
  SceneMode$3 = Cesium$e.SceneMode,
  VertexFormat = Cesium$e.VertexFormat,
  CesiumMath = Cesium$e.Math,
  Matrix3 = Cesium$e.Matrix3,
  Matrix4$1 = Cesium$e.Matrix4,
  JulianDate = Cesium$e.JulianDate,
  sin = Math.sin,
  cos = Math.cos,
  tan = Math.tan,
  atan = Math.atan,
  attributeLocations = { position: 0, normal: 1 };
function ScanRadarPrimitive(options) {
  var self = this;
  (options = defaultValue(options, defaultValue.EMPTY_OBJECT)),
    (this.show = defaultValue(options.show, !0)),
    (this.slice = defaultValue(options.slice, 32)),
    (this.modelMatrix = Matrix4$1.clone(options.modelMatrix, new Matrix4$1())),
    (this._modelMatrix = new Matrix4$1()),
    (this._computedModelMatrix = new Matrix4$1()),
    (this._computedScanPlaneModelMatrix = new Matrix4$1()),
    (this.radius = defaultValue(options.radius, Number.POSITIVE_INFINITY)),
    (this._radius = void 0),
    (this.xHalfAngle = defaultValue(options.xHalfAngle, 0)),
    (this._xHalfAngle = void 0),
    (this.yHalfAngle = defaultValue(options.yHalfAngle, 0)),
    (this._yHalfAngle = void 0),
    (this.lineColor = defaultValue(options.lineColor, Color.WHITE)),
    (this.showSectorLines = defaultValue(options.showSectorLines, !0)),
    (this.showSectorSegmentLines = defaultValue(
      options.showSectorSegmentLines,
      !0
    )),
    (this.showLateralSurfaces = defaultValue(options.showLateralSurfaces, !0)),
    (this.material = defined$7(options.material)
      ? options.material
      : Material.fromType(Material.ColorType)),
    (this._material = void 0),
    (this._translucent = void 0),
    (this.lateralSurfaceMaterial = defined$7(options.lateralSurfaceMaterial)
      ? options.lateralSurfaceMaterial
      : Material.fromType(Material.ColorType)),
    (this._lateralSurfaceMaterial = void 0),
    (this._lateralSurfaceTranslucent = void 0),
    (this.showDomeSurfaces = defaultValue(options.showDomeSurfaces, !0)),
    (this.domeSurfaceMaterial = defined$7(options.domeSurfaceMaterial)
      ? options.domeSurfaceMaterial
      : Material.fromType(Material.ColorType)),
    (this._domeSurfaceMaterial = void 0),
    (this.showDomeLines = defaultValue(options.showDomeLines, !0)),
    (this.showIntersection = defaultValue(options.showIntersection, !0)),
    (this.intersectionColor = defaultValue(
      options.intersectionColor,
      Color.WHITE
    )),
    (this.intersectionWidth = defaultValue(options.intersectionWidth, 5)),
    (this.showThroughEllipsoid = defaultValue(
      options.showThroughEllipsoid,
      !1
    )),
    (this._showThroughEllipsoid = void 0),
    (this.showScanPlane = defaultValue(options.showScanPlane, !0)),
    (this.scanPlaneColor = defaultValue(options.scanPlaneColor, Color.WHITE)),
    (this.scanPlaneMode = defaultValue(options.scanPlaneMode, "horizontal")),
    (this.scanPlaneRate = defaultValue(options.scanPlaneRate, 10)),
    (this._scanePlaneXHalfAngle = 0),
    (this._scanePlaneYHalfAngle = 0),
    (this._time = JulianDate.now()),
    (this._boundingSphere = new BoundingSphere$1()),
    (this._boundingSphereWC = new BoundingSphere$1()),
    (this._sectorFrontCommand = new DrawCommand({
      owner: this,
      primitiveType: PrimitiveType.TRIANGLES,
      boundingVolume: this._boundingSphereWC,
    })),
    (this._sectorBackCommand = new DrawCommand({
      owner: this,
      primitiveType: PrimitiveType.TRIANGLES,
      boundingVolume: this._boundingSphereWC,
    })),
    (this._sectorVA = void 0),
    (this._sectorLineCommand = new DrawCommand({
      owner: this,
      primitiveType: PrimitiveType.LINES,
      boundingVolume: this._boundingSphereWC,
    })),
    (this._sectorLineVA = void 0),
    (this._sectorSegmentLineCommand = new DrawCommand({
      owner: this,
      primitiveType: PrimitiveType.LINES,
      boundingVolume: this._boundingSphereWC,
    })),
    (this._sectorSegmentLineVA = void 0),
    (this._domeFrontCommand = new DrawCommand({
      owner: this,
      primitiveType: PrimitiveType.TRIANGLES,
      boundingVolume: this._boundingSphereWC,
    })),
    (this._domeBackCommand = new DrawCommand({
      owner: this,
      primitiveType: PrimitiveType.TRIANGLES,
      boundingVolume: this._boundingSphereWC,
    })),
    (this._domeVA = void 0),
    (this._domeLineCommand = new DrawCommand({
      owner: this,
      primitiveType: PrimitiveType.LINES,
      boundingVolume: this._boundingSphereWC,
    })),
    (this._domeLineVA = void 0),
    (this._scanPlaneFrontCommand = new DrawCommand({
      owner: this,
      primitiveType: PrimitiveType.TRIANGLES,
      boundingVolume: this._boundingSphereWC,
    })),
    (this._scanPlaneBackCommand = new DrawCommand({
      owner: this,
      primitiveType: PrimitiveType.TRIANGLES,
      boundingVolume: this._boundingSphereWC,
    })),
    (this._scanRadialCommand = void 0),
    (this._colorCommands = []),
    (this._frontFaceRS = void 0),
    (this._backFaceRS = void 0),
    (this._sp = void 0),
    (this._uniforms = {
      u_type: function () {
        return 0;
      },
      u_xHalfAngle: function () {
        return self.xHalfAngle;
      },
      u_yHalfAngle: function () {
        return self.yHalfAngle;
      },
      u_radius: function () {
        return self.radius;
      },
      u_showThroughEllipsoid: function () {
        return self.showThroughEllipsoid;
      },
      u_showIntersection: function () {
        return self.showIntersection;
      },
      u_intersectionColor: function () {
        return self.intersectionColor;
      },
      u_intersectionWidth: function () {
        return self.intersectionWidth;
      },
      u_normalDirection: function () {
        return 1;
      },
      u_lineColor: function () {
        return self.lineColor;
      },
    }),
    (this._scanUniforms = {
      u_xHalfAngle: function () {
        return self._scanePlaneXHalfAngle;
      },
      u_yHalfAngle: function () {
        return self._scanePlaneYHalfAngle;
      },
      u_radius: function () {
        return self.radius;
      },
      u_color: function () {
        return self.scanPlaneColor;
      },
      u_showThroughEllipsoid: function () {
        return self.showThroughEllipsoid;
      },
      u_showIntersection: function () {
        return self.showIntersection;
      },
      u_intersectionColor: function () {
        return self.intersectionColor;
      },
      u_intersectionWidth: function () {
        return self.intersectionWidth;
      },
      u_normalDirection: function () {
        return 1;
      },
      u_lineColor: function () {
        return self.lineColor;
      },
    });
}
ScanRadarPrimitive.prototype.update = function (frameState) {
  var mode = frameState.mode;
  if (this.show && mode === SceneMode$3.SCENE3D) {
    var mode = !1,
      createRS = !1,
      createSP = !1,
      xHalfAngle = this.xHalfAngle,
      yHalfAngle = this.yHalfAngle;
    if (xHalfAngle < 0 || yHalfAngle < 0)
      throw new DeveloperError$3(
        "halfAngle must be greater than or equal to zero."
      );
    if (0 != xHalfAngle && 0 != yHalfAngle) {
      (this._xHalfAngle === xHalfAngle && this._yHalfAngle === yHalfAngle) ||
        ((this._xHalfAngle = xHalfAngle),
        (this._yHalfAngle = yHalfAngle),
        (mode = !0));
      var radius = this.radius;
      if (radius < 0)
        throw new DeveloperError$3(
          "this.radius must be greater than or equal to zero."
        );
      var radiusChanged = !1;
      this._radius !== radius &&
        ((radiusChanged = !0),
        (this._radius = radius),
        (this._boundingSphere = new BoundingSphere$1(
          Cartesian3$3.ZERO,
          this.radius
        )));
      (!Matrix4$1.equals(this.modelMatrix, this._modelMatrix) ||
        radiusChanged) &&
        (Matrix4$1.clone(this.modelMatrix, this._modelMatrix),
        Matrix4$1.multiplyByUniformScale(
          this.modelMatrix,
          this.radius,
          this._computedModelMatrix
        ),
        BoundingSphere$1.transform(
          this._boundingSphere,
          this.modelMatrix,
          this._boundingSphereWC
        ));
      var angle,
        tanXHalfAngle,
        timeDiff,
        time,
        radius = this.showThroughEllipsoid,
        radiusChanged =
          (this._showThroughEllipsoid !== this.showThroughEllipsoid &&
            ((this._showThroughEllipsoid = radius), (createRS = !0)),
          this.material),
        translucent =
          (this._material !== radiusChanged &&
            ((this._material = radiusChanged), (createSP = createRS = !0)),
          radiusChanged.isTranslucent()),
        commandList =
          (this._translucent !== translucent &&
            ((this._translucent = translucent), (createRS = !0)),
          this.showScanPlane &&
            ((time = frameState.time),
            (timeDiff = JulianDate.secondsDifference(time, this._time)) < 0 &&
              (this._time = JulianDate.clone(time, this._time)),
            (time = Math.max(
              (timeDiff % this.scanPlaneRate) / this.scanPlaneRate,
              0
            )),
            console.log(time),
            "horizontal" == this.scanPlaneMode
              ? ((timeDiff = cos((angle = 2 * yHalfAngle * time - yHalfAngle))),
                (tanXHalfAngle = tan(xHalfAngle)),
                (timeDiff = atan(timeDiff * tanXHalfAngle)),
                (this._scanePlaneXHalfAngle = timeDiff),
                (this._scanePlaneYHalfAngle = angle),
                Cesium$e.Matrix3.fromRotationX(
                  this._scanePlaneYHalfAngle,
                  matrix3Scratch
                ))
              : ((angle = 2 * xHalfAngle * time - xHalfAngle),
                (tanXHalfAngle = tan(yHalfAngle)),
                (timeDiff = cos(angle)),
                (time = atan(timeDiff * tanXHalfAngle)),
                (this._scanePlaneXHalfAngle = angle),
                (this._scanePlaneYHalfAngle = time),
                Cesium$e.Matrix3.fromRotationY(
                  this._scanePlaneXHalfAngle,
                  matrix3Scratch
                )),
            Cesium$e.Matrix4.multiplyByMatrix3(
              this.modelMatrix,
              matrix3Scratch,
              this._computedScanPlaneModelMatrix
            ),
            Matrix4$1.multiplyByUniformScale(
              this._computedScanPlaneModelMatrix,
              this.radius,
              this._computedScanPlaneModelMatrix
            )),
          mode && createVertexArray(this, frameState),
          createRS && createRenderState(this, radius, translucent),
          createSP && createShaderProgram(this, frameState, radiusChanged),
          (createRS || createSP) && createCommands(this, translucent),
          frameState.commandList),
        xHalfAngle = frameState.passes,
        colorCommands = this._colorCommands;
      if (xHalfAngle.render)
        for (var i = 0, len = colorCommands.length; i < len; i++) {
          var colorCommand = colorCommands[i];
          commandList.push(colorCommand);
        }
    }
  }
};
var matrix3Scratch = new Matrix3(),
  nScratch = new Cartesian3$3();
function computeUnitPosiiton(primitive, xHalfAngle, yHalfAngle) {
  for (
    var slice = primitive.slice,
      primitive = cos(yHalfAngle),
      yHalfAngle = tan(yHalfAngle),
      cosXHalfAngle = cos(xHalfAngle),
      xHalfAngle = tan(xHalfAngle),
      maxY = atan(cosXHalfAngle * yHalfAngle),
      maxX = atan(primitive * xHalfAngle),
      zoy = [],
      i = 0;
    i < slice;
    i++
  ) {
    var phi = (2 * maxY * i) / (slice - 1) - maxY;
    zoy.push(new Cartesian3$3(0, sin(phi), cos(phi)));
  }
  for (var zox = [], i = 0; i < slice; i++) {
    phi = (2 * maxX * i) / (slice - 1) - maxX;
    zox.push(new Cartesian3$3(sin(phi), 0, cos(phi)));
  }
  return { zoy: zoy, zox: zox };
}
function computeSectorPositions(primitive, unitPosition) {
  var xHalfAngle = primitive.xHalfAngle,
    primitive = primitive.yHalfAngle,
    zoy = unitPosition.zoy,
    unitPosition = unitPosition.zox,
    positions = [],
    matrix3 = Matrix3.fromRotationY(xHalfAngle, matrix3Scratch),
    matrix3 =
      (positions.push(
        zoy.map(function (p) {
          return Matrix3.multiplyByVector(
            matrix3,
            p,
            new Cesium$e.Cartesian3()
          );
        })
      ),
      Matrix3.fromRotationX(-primitive, matrix3Scratch)),
    matrix3 =
      (positions.push(
        unitPosition
          .map(function (p) {
            return Matrix3.multiplyByVector(
              matrix3,
              p,
              new Cesium$e.Cartesian3()
            );
          })
          .reverse()
      ),
      Matrix3.fromRotationY(-xHalfAngle, matrix3Scratch)),
    matrix3 =
      (positions.push(
        zoy
          .map(function (p) {
            return Matrix3.multiplyByVector(
              matrix3,
              p,
              new Cesium$e.Cartesian3()
            );
          })
          .reverse()
      ),
      Matrix3.fromRotationX(primitive, matrix3Scratch));
  return (
    positions.push(
      unitPosition.map(function (p) {
        return Matrix3.multiplyByVector(matrix3, p, new Cesium$e.Cartesian3());
      })
    ),
    positions
  );
}
function createSectorVertexArray(context, positions) {
  for (
    var planeLength =
        Array.prototype.concat.apply([], positions).length - positions.length,
      vertices = new Float32Array(18 * planeLength),
      k = 0,
      i = 0,
      len = positions.length;
    i < len;
    i++
  )
    for (
      var planePositions = positions[i],
        n = Cartesian3$3.normalize(
          Cartesian3$3.cross(
            planePositions[0],
            planePositions[planePositions.length - 1],
            nScratch
          ),
          nScratch
        ),
        j = 0,
        planeLength = planePositions.length - 1;
      j < planeLength;
      j++
    )
      (vertices[k++] = 0),
        (vertices[k++] = 0),
        (vertices[k++] = 0),
        (vertices[k++] = -n.x),
        (vertices[k++] = -n.y),
        (vertices[k++] = -n.z),
        (vertices[k++] = planePositions[j].x),
        (vertices[k++] = planePositions[j].y),
        (vertices[k++] = planePositions[j].z),
        (vertices[k++] = -n.x),
        (vertices[k++] = -n.y),
        (vertices[k++] = -n.z),
        (vertices[k++] = planePositions[j + 1].x),
        (vertices[k++] = planePositions[j + 1].y),
        (vertices[k++] = planePositions[j + 1].z),
        (vertices[k++] = -n.x),
        (vertices[k++] = -n.y),
        (vertices[k++] = -n.z);
  var vertexBuffer = Buffer.createVertexBuffer({
      context: context,
      typedArray: vertices,
      usage: BufferUsage.STATIC_DRAW,
    }),
    stride = 6 * Float32Array.BYTES_PER_ELEMENT,
    vertexBuffer = [
      {
        index: attributeLocations.position,
        vertexBuffer: vertexBuffer,
        componentsPerAttribute: 3,
        componentDatatype: ComponentDatatype.FLOAT,
        offsetInBytes: 0,
        strideInBytes: stride,
      },
      {
        index: attributeLocations.normal,
        vertexBuffer: vertexBuffer,
        componentsPerAttribute: 3,
        componentDatatype: ComponentDatatype.FLOAT,
        offsetInBytes: 3 * Float32Array.BYTES_PER_ELEMENT,
        strideInBytes: stride,
      },
    ];
  return new VertexArray({ context: context, attributes: vertexBuffer });
}
function createSectorLineVertexArray(context, positions) {
  for (
    var planeLength = positions.length,
      vertices = new Float32Array(9 * planeLength),
      k = 0,
      i = 0,
      len = positions.length;
    i < len;
    i++
  ) {
    var planePositions = positions[i];
    (vertices[k++] = 0),
      (vertices[k++] = 0),
      (vertices[k++] = 0),
      (vertices[k++] = planePositions[0].x),
      (vertices[k++] = planePositions[0].y),
      (vertices[k++] = planePositions[0].z);
  }
  var planeLength = Buffer.createVertexBuffer({
      context: context,
      typedArray: vertices,
      usage: BufferUsage.STATIC_DRAW,
    }),
    stride = 3 * Float32Array.BYTES_PER_ELEMENT,
    planeLength = [
      {
        index: attributeLocations.position,
        vertexBuffer: planeLength,
        componentsPerAttribute: 3,
        componentDatatype: ComponentDatatype.FLOAT,
        offsetInBytes: 0,
        strideInBytes: stride,
      },
    ];
  return new VertexArray({ context: context, attributes: planeLength });
}
function createSectorSegmentLineVertexArray(context, positions) {
  for (
    var planeLength =
        Array.prototype.concat.apply([], positions).length - positions.length,
      vertices = new Float32Array(9 * planeLength),
      k = 0,
      i = 0,
      len = positions.length;
    i < len;
    i++
  )
    for (
      var planePositions = positions[i],
        j = 0,
        planeLength = planePositions.length - 1;
      j < planeLength;
      j++
    )
      (vertices[k++] = planePositions[j].x),
        (vertices[k++] = planePositions[j].y),
        (vertices[k++] = planePositions[j].z),
        (vertices[k++] = planePositions[j + 1].x),
        (vertices[k++] = planePositions[j + 1].y),
        (vertices[k++] = planePositions[j + 1].z);
  var vertexBuffer = Buffer.createVertexBuffer({
      context: context,
      typedArray: vertices,
      usage: BufferUsage.STATIC_DRAW,
    }),
    stride = 3 * Float32Array.BYTES_PER_ELEMENT,
    vertexBuffer = [
      {
        index: attributeLocations.position,
        vertexBuffer: vertexBuffer,
        componentsPerAttribute: 3,
        componentDatatype: ComponentDatatype.FLOAT,
        offsetInBytes: 0,
        strideInBytes: stride,
      },
    ];
  return new VertexArray({ context: context, attributes: vertexBuffer });
}
function createDomeVertexArray(context) {
  var geometry = Cesium$e.EllipsoidGeometry.createGeometry(
    new Cesium$e.EllipsoidGeometry({
      vertexFormat: VertexFormat.POSITION_ONLY,
      stackPartitions: 32,
      slicePartitions: 32,
    })
  );
  return VertexArray.fromGeometry({
    context: context,
    geometry: geometry,
    attributeLocations: attributeLocations,
    bufferUsage: BufferUsage.STATIC_DRAW,
    interleave: !1,
  });
}
function createDomeLineVertexArray(context) {
  var geometry = Cesium$e.EllipsoidOutlineGeometry.createGeometry(
    new Cesium$e.EllipsoidOutlineGeometry({
      vertexFormat: VertexFormat.POSITION_ONLY,
      stackPartitions: 32,
      slicePartitions: 32,
    })
  );
  return VertexArray.fromGeometry({
    context: context,
    geometry: geometry,
    attributeLocations: attributeLocations,
    bufferUsage: BufferUsage.STATIC_DRAW,
    interleave: !1,
  });
}
function createScanPlaneVertexArray(context, positions) {
  for (
    var planeLength = positions.length - 1,
      vertices = new Float32Array(9 * planeLength),
      k = 0,
      i = 0;
    i < planeLength;
    i++
  )
    (vertices[k++] = 0),
      (vertices[k++] = 0),
      (vertices[k++] = 0),
      (vertices[k++] = positions[i].x),
      (vertices[k++] = positions[i].y),
      (vertices[k++] = positions[i].z),
      (vertices[k++] = positions[i + 1].x),
      (vertices[k++] = positions[i + 1].y),
      (vertices[k++] = positions[i + 1].z);
  var vertexBuffer = Buffer.createVertexBuffer({
      context: context,
      typedArray: vertices,
      usage: BufferUsage.STATIC_DRAW,
    }),
    stride = 3 * Float32Array.BYTES_PER_ELEMENT,
    vertexBuffer = [
      {
        index: attributeLocations.position,
        vertexBuffer: vertexBuffer,
        componentsPerAttribute: 3,
        componentDatatype: ComponentDatatype.FLOAT,
        offsetInBytes: 0,
        strideInBytes: stride,
      },
    ];
  return new VertexArray({ context: context, attributes: vertexBuffer });
}
function createVertexArray(primitive, frameState) {
  var unitScanPlanePositions,
    frameState = frameState.context,
    positions = computeSectorPositions(
      primitive,
      computeUnitPosiiton(primitive, primitive.xHalfAngle, primitive.yHalfAngle)
    );
  primitive.showLateralSurfaces &&
    (primitive._sectorVA = createSectorVertexArray(frameState, positions)),
    primitive.showSectorLines &&
      (primitive._sectorLineVA = createSectorLineVertexArray(
        frameState,
        positions
      )),
    primitive.showSectorSegmentLines &&
      (primitive._sectorSegmentLineVA = createSectorSegmentLineVertexArray(
        frameState,
        positions
      )),
    primitive.showDomeSurfaces &&
      (primitive._domeVA = createDomeVertexArray(frameState)),
    primitive.showDomeLines &&
      (primitive._domeLineVA = createDomeLineVertexArray(frameState)),
    primitive.showScanPlane &&
      ("horizontal" == primitive.scanPlaneMode
        ? ((unitScanPlanePositions = computeUnitPosiiton(
            primitive,
            CesiumMath.PI_OVER_TWO,
            0
          )),
          (primitive._scanPlaneVA = createScanPlaneVertexArray(
            frameState,
            unitScanPlanePositions.zox
          )))
        : ((unitScanPlanePositions = computeUnitPosiiton(
            primitive,
            0,
            CesiumMath.PI_OVER_TWO
          )),
          (primitive._scanPlaneVA = createScanPlaneVertexArray(
            frameState,
            unitScanPlanePositions.zoy
          ))));
}
function createCommonShaderProgram(primitive, frameState, material) {
  var frameState = frameState.context,
    vs = shader2,
    fs = new ShaderSource({
      sources: [shader3, material.shaderSource, shader1],
    }),
    fs =
      ((primitive._sp = ShaderProgram.replaceCache({
        context: frameState,
        shaderProgram: primitive._sp,
        vertexShaderSource: vs,
        fragmentShaderSource: fs,
        attributeLocations: attributeLocations,
      })),
      new ShaderSource({
        sources: [shader3, material.shaderSource, shader1],
        pickColorQualifier: "uniform",
      }));
  primitive._pickSP = ShaderProgram.replaceCache({
    context: frameState,
    shaderProgram: primitive._pickSP,
    vertexShaderSource: vs,
    fragmentShaderSource: fs,
    attributeLocations: attributeLocations,
  });
}
function createScanPlaneShaderProgram(primitive, frameState, material) {
  var frameState = frameState.context,
    vs = shader2,
    material = new ShaderSource({
      sources: [shader3, material.shaderSource, shader4],
    });
  primitive._scanePlaneSP = ShaderProgram.replaceCache({
    context: frameState,
    shaderProgram: primitive._scanePlaneSP,
    vertexShaderSource: vs,
    fragmentShaderSource: material,
    attributeLocations: attributeLocations,
  });
}
function createShaderProgram(primitive, frameState, material) {
  createCommonShaderProgram(primitive, frameState, material),
    primitive.showScanPlane &&
      createScanPlaneShaderProgram(primitive, frameState, material);
}
function createRenderState(primitive, showThroughEllipsoid, translucent) {
  translucent
    ? ((primitive._frontFaceRS = RenderState.fromCache({
        depthTest: { enabled: !showThroughEllipsoid },
        depthMask: !1,
        blending: BlendingState.ALPHA_BLEND,
        cull: { enabled: !0, face: CullFace.BACK },
      })),
      (primitive._backFaceRS = RenderState.fromCache({
        depthTest: { enabled: !showThroughEllipsoid },
        depthMask: !1,
        blending: BlendingState.ALPHA_BLEND,
        cull: { enabled: !0, face: CullFace.FRONT },
      })),
      (primitive._pickRS = RenderState.fromCache({
        depthTest: { enabled: !showThroughEllipsoid },
        depthMask: !1,
        blending: BlendingState.ALPHA_BLEND,
      })))
    : ((primitive._frontFaceRS = RenderState.fromCache({
        depthTest: { enabled: !showThroughEllipsoid },
        depthMask: !0,
      })),
      (primitive._pickRS = RenderState.fromCache({
        depthTest: { enabled: !0 },
        depthMask: !0,
      })));
}
function createCommand(
  primitive,
  frontCommand,
  backCommand,
  frontFaceRS,
  backFaceRS,
  sp,
  va,
  uniforms,
  modelMatrix,
  translucent,
  pass,
  isLine
) {
  translucent &&
    backCommand &&
    ((backCommand.vertexArray = va),
    (backCommand.renderState = backFaceRS),
    (backCommand.shaderProgram = sp),
    (backCommand.uniformMap = combine(uniforms, primitive._material._uniforms)),
    (backCommand.uniformMap.u_normalDirection = function () {
      return -1;
    }),
    (backCommand.pass = pass),
    (backCommand.modelMatrix = modelMatrix),
    primitive._colorCommands.push(backCommand)),
    (frontCommand.vertexArray = va),
    (frontCommand.renderState = frontFaceRS),
    (frontCommand.shaderProgram = sp),
    (frontCommand.uniformMap = combine(
      uniforms,
      primitive._material._uniforms
    )),
    isLine &&
      (frontCommand.uniformMap.u_type = function () {
        return 1;
      }),
    (frontCommand.pass = pass),
    (frontCommand.modelMatrix = modelMatrix),
    primitive._colorCommands.push(frontCommand);
}
function createCommands(primitive, translucent) {
  primitive._colorCommands.length = 0;
  var pass = translucent ? Pass.TRANSLUCENT : Pass.OPAQUE;
  primitive.showLateralSurfaces &&
    createCommand(
      primitive,
      primitive._sectorFrontCommand,
      primitive._sectorBackCommand,
      primitive._frontFaceRS,
      primitive._backFaceRS,
      primitive._sp,
      primitive._sectorVA,
      primitive._uniforms,
      primitive._computedModelMatrix,
      translucent,
      pass
    ),
    primitive.showSectorLines &&
      createCommand(
        primitive,
        primitive._sectorLineCommand,
        void 0,
        primitive._frontFaceRS,
        primitive._backFaceRS,
        primitive._sp,
        primitive._sectorLineVA,
        primitive._uniforms,
        primitive._computedModelMatrix,
        translucent,
        pass,
        !0
      ),
    primitive.showSectorSegmentLines &&
      createCommand(
        primitive,
        primitive._sectorSegmentLineCommand,
        void 0,
        primitive._frontFaceRS,
        primitive._backFaceRS,
        primitive._sp,
        primitive._sectorSegmentLineVA,
        primitive._uniforms,
        primitive._computedModelMatrix,
        translucent,
        pass,
        !0
      ),
    primitive.showDomeSurfaces &&
      createCommand(
        primitive,
        primitive._domeFrontCommand,
        primitive._domeBackCommand,
        primitive._frontFaceRS,
        primitive._backFaceRS,
        primitive._sp,
        primitive._domeVA,
        primitive._uniforms,
        primitive._computedModelMatrix,
        translucent,
        pass
      ),
    primitive.showDomeLines &&
      createCommand(
        primitive,
        primitive._domeLineCommand,
        void 0,
        primitive._frontFaceRS,
        primitive._backFaceRS,
        primitive._sp,
        primitive._domeLineVA,
        primitive._uniforms,
        primitive._computedModelMatrix,
        translucent,
        pass,
        !0
      ),
    primitive.showScanPlane &&
      createCommand(
        primitive,
        primitive._scanPlaneFrontCommand,
        primitive._scanPlaneBackCommand,
        primitive._frontFaceRS,
        primitive._backFaceRS,
        primitive._scanePlaneSP,
        primitive._scanPlaneVA,
        primitive._scanUniforms,
        primitive._computedScanPlaneModelMatrix,
        translucent,
        pass
      );
}
var originalDefaultVisualizersCallback =
    Cesium$e.DataSourceDisplay.defaultVisualizersCallback,
  sensor =
    ((Cesium$e.DataSourceDisplay.defaultVisualizersCallback = function (
      scene,
      entityCluster,
      dataSource
    ) {
      var entities = dataSource.entities;
      return originalDefaultVisualizersCallback(
        scene,
        entityCluster,
        dataSource
      ).concat([new ScanRadarVisualizer(scene, entities)]);
    }),
    Object.freeze({
      __proto__: null,
      CamberRadarPrimitive: CamberRadarPrimitive,
      CylinderRadarPrimitive: CylinderRadarPrimitive,
      ScanRadarGraphics: ScanRadarGraphics,
    })),
  PopupTooltipTool = (function () {
    function PopupTooltipTool(viewer) {
      _classCallCheck(this, PopupTooltipTool),
        (this.viewer = viewer),
        (this.toolOpen = !0),
        (this.popupHandler = new Cesium.ScreenSpaceEventHandler(
          this.viewer.scene.canvas
        )),
        (this.tooltipHandler = new Cesium.ScreenSpaceEventHandler(
          this.viewer.scene.canvas
        )),
        (this.defaultVal = { type: 2, show: !0 }),
        (this.lastTooltipObj = void 0);
    }
    return (
      _createClass(PopupTooltipTool, [
        {
          key: "getPickobj",
          value: function (px) {
            var tileFeature,
              obj,
              px = this.viewer.scene.pick(px);
            if (px)
              return (
                px.id && px.id instanceof Cesium.Entity
                  ? (obj = px.id)
                  : !px.primitive ||
                    px.primitive instanceof Cesium.Cesium3DTileset
                  ? px.primitive &&
                    px.primitive instanceof Cesium.Cesium3DTileset &&
                    (px instanceof Cesium.Cesium3DTileFeature &&
                      (tileFeature = px),
                    (obj = px.primitive))
                  : (obj = px.primitive),
                { obj: obj, tileFeature: tileFeature }
              );
          },
        },
        {
          key: "bindPopup",
          value: function () {
            var _this = this;
            this.popupHandler.setInputAction(function (evt) {
              var res, _popup;
              !_this.toolOpen ||
                ((res = _this.getPickobj(evt.position)) &&
                  res.obj &&
                  (res = res.obj) &&
                  res.popup &&
                  (res.popupPrompt
                    ? res.isPointType
                      ? res.popupPrompt.setVisible(!0)
                      : (res.popupPrompt.destroy(),
                        (res.popupPrompt = void 0),
                        (_popup = {}),
                        "string" == typeof res.popup
                          ? (_popup.content = res.popup)
                          : (_popup = Object.assign(_popup, res.popup)),
                        (_popup.type = _popup.type || 2),
                        (res.popupPrompt = _this.createPrompt(
                          res,
                          _popup,
                          evt.position
                        )))
                    : ((_popup = {}),
                      "string" == typeof res.popup
                        ? (_popup.content = res.popup)
                        : (_popup = Object.assign(_popup, res.popup)),
                      (_popup.type = _popup.type || 2),
                      (res.popupPrompt = _this.createPrompt(
                        res,
                        _popup,
                        evt.position
                      )))));
            }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
          },
        },
        {
          key: "bindTooltip",
          value: function () {
            var _this2 = this;
            this.popupHandler.setInputAction(function (evt) {
              var popup,
                res = _this2.getPickobj(evt.endPosition);
              res && res.obj
                ? ((res = res.obj),
                  _this2.lastTooltipObj &&
                    res.tooltipId != _this2.lastTooltipObj.tooltipId &&
                    (_this2.lastTooltipObj.tooltipPrompt &&
                      (_this2.lastTooltipObj.tooltipPrompt.destroy(),
                      (_this2.lastTooltipObj.tooltipPrompt = void 0)),
                    (_this2.lastTooltipObj = void 0)),
                  res.tooltip &&
                    (res.tooltipPrompt
                      ? res.tooltipPrompt.update({
                          x: evt.endPosition.x,
                          y: evt.endPosition.y - 4,
                        })
                      : ((popup = {}),
                        "string" == typeof res.tooltip
                          ? (popup.content = res.tooltip)
                          : (popup = Object.assign(popup, res.tooltip)),
                        (popup.type = popup.type || 2),
                        (res.tooltipPrompt = _this2.createPrompt(
                          res,
                          popup,
                          evt.endPosition
                        ))),
                    (res.tooltipId =
                      new Date().getTime() +
                      "" +
                      Math.floor(1e4 * Math.random()) +
                      Math.floor(1e4 * Math.random())),
                    (_this2.lastTooltipObj = res)))
                : _this2.lastTooltipObj &&
                  _this2.lastTooltipObj.tooltipPrompt &&
                  (_this2.lastTooltipObj.tooltipPrompt.destroy(),
                  (_this2.lastTooltipObj.tooltipPrompt = void 0),
                  (_this2.lastTooltipObj = void 0));
            }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "createPrompt",
          value: function (obj, promptAttr, px) {
            var position,
              ent,
              newPosition,
              height,
              defaultVal = JSON.parse(JSON.stringify(this.defaultVal));
            return (
              obj instanceof Cesium.Entity &&
                ((obj.billboard || obj.point || obj.model) &&
                  ((ent = obj.billboard || obj.point || obj.model),
                  (position = obj.position.getValue(
                    this.viewer.clock.currentTime
                  )),
                  1 == ent.heightReference.getValue() &&
                    ((ent = Cesium.Cartographic.fromCartesian(position)),
                    null ==
                    (height = this.viewer.scene.sampleHeight(ent.clone()))
                      ? ((newPosition = this.viewer.scene.pickPosition({
                          x: px.x + 1,
                          y: px.y + 1,
                        })),
                        (height =
                          Cesium.Cartographic.fromCartesian(
                            newPosition
                          ).height))
                      : (ent.height = height),
                    (position = Cesium.Cartographic.toCartesian(ent))),
                  (obj.isPointType = !0)),
                (obj.polyline ||
                  obj.polygon ||
                  obj.rectangle ||
                  obj.ellipse ||
                  obj.plane ||
                  obj.path) &&
                  ((position = this.viewer.scene.pickPosition(px)),
                  (obj.isPointType = !1))),
              obj.tooltip && (this.defaultVal.closeBtn = !1),
              (defaultVal.position = position),
              promptAttr.constructor == String
                ? (defaultVal.content = promptAttr)
                : (defaultVal = Object.assign(defaultVal, promptAttr)),
              new Prompt$1(this.viewer, defaultVal)
            );
          },
        },
        {
          key: "close",
          value: function () {
            this.toolOpen = !1;
          },
        },
        {
          key: "open",
          value: function () {
            this.toolOpen = !0;
          },
        },
      ]),
      PopupTooltipTool
    );
  })(),
  CustomHandler = (function () {
    function CustomHandler(viewer) {
      _classCallCheck(this, CustomHandler),
        (this.viewer = viewer),
        (this.clickHandler = void 0),
        (this.mouseMoveHandler = void 0),
        (this.rightClickHandler = void 0),
        (this.lastobj_click = void 0),
        (this.lastobj_mouseMove = void 0),
        (this.lastobj_rightClick = void 0);
    }
    return (
      _createClass(CustomHandler, [
        {
          key: "click",
          value: function () {
            var _this = this;
            this.clickHandler ||
              (this.clickHandler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.clickHandler.setInputAction(function (evt) {
                var res = _this.getPickobj(evt.position);
                res
                  ? (_this.pickDiff(
                      evt,
                      res,
                      _this.lastobj_click,
                      "click",
                      "unClick"
                    ),
                    (_this.lastobj_click = res))
                  : (_this.pickNull(evt, _this.lastobj_click, "unClick"),
                    (_this.lastobj_click = void 0));
              }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
          },
        },
        {
          key: "mouseMove",
          value: function () {
            var _this2 = this;
            this.mouseMoveHandler ||
              (this.mouseMoveHandler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.mouseMoveHandler.setInputAction(function (evt) {
                var res = _this2.getPickobj(evt.endPosition);
                res
                  ? (_this2.pickDiff(
                      evt,
                      res,
                      _this2.lastobj_mouseMove,
                      "mouseMove",
                      "unMouseMove"
                    ),
                    (_this2.lastobj_mouseMove = res))
                  : (_this2.pickNull(
                      evt,
                      _this2.lastobj_mouseMove,
                      "unMouseMove"
                    ),
                    (_this2.lastobj_mouseMove = void 0));
              }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
          },
        },
        {
          key: "rightClick",
          value: function () {
            var _this3 = this;
            this.rightClickHandler ||
              (this.rightClickHandler = new Cesium.ScreenSpaceEventHandler(
                this.viewer.scene.canvas
              )),
              this.rightClickHandler.setInputAction(function (evt) {
                var res = _this3.getPickobj(evt.position);
                res
                  ? (_this3.pickDiff(
                      evt,
                      res,
                      _this3.lastobj_rightClick,
                      "rightClick",
                      "unRightClick"
                    ),
                    (_this3.lastobj_rightClick = res))
                  : (_this3.pickNull(
                      evt,
                      _this3.lastobj_rightClick,
                      "unRightClick"
                    ),
                    (_this3.lastobj_rightClick = void 0));
              }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
          },
        },
        {
          key: "destroy",
          value: function () {
            this.clickHandler &&
              (this.clickHandler.destroy(), (this.clickHandler = void 0)),
              this.mouseMoveHandler &&
                (this.mouseMoveHandler.destroy(),
                (this.mouseMoveHandler = void 0)),
              this.rightClickHandler &&
                (this.rightClickHandler.destroy(),
                (this.rightClickHandler = void 0)),
              (this.lastobj_click = void 0),
              (this.lastobj_mouseMove = void 0),
              (this.lastobj_rightClick = void 0);
          },
        },
        {
          key: "getPickobj",
          value: function (px) {
            var tileFeature,
              obj,
              px = this.viewer.scene.pick(px);
            if (px)
              return (
                (px.id && px.id instanceof Cesium.Entity) || px._model
                  ? (obj = px.id || px._model.id)
                  : !px.primitive ||
                    px.primitive instanceof Cesium.Cesium3DTileset
                  ? px.primitive &&
                    px.primitive instanceof Cesium.Cesium3DTileset &&
                    (px instanceof Cesium.Cesium3DTileFeature &&
                      (tileFeature = px),
                    (obj = px.primitive))
                  : (obj = px.primitive),
                (obj.randomId = this.getRandomId()),
                { obj: obj, tileFeature: tileFeature }
              );
          },
        },
        {
          key: "pickNull",
          value: function (evt, lastpick, pickType) {
            lastpick &&
              lastpick.obj &&
              lastpick.obj[pickType] &&
              lastpick.obj[pickType](evt, lastpick.obj);
          },
        },
        {
          key: "pickDiff",
          value: function (evt, res, lastpick, pickType, unpickType) {
            lastpick &&
              (lastpick.obj.randomId != res.obj.randomId
                ? lastpick &&
                  lastpick.obj[unpickType] &&
                  lastpick.obj[unpickType](evt, lastpick.obj)
                : res.tileFeature &&
                  lastpick.tileFeature &&
                  res.tileFeature._batchId != lastpick.tileFeature._batchId &&
                  lastpick &&
                  lastpick.obj[unpickType] &&
                  lastpick.obj[unpickType](evt, lastpick.obj)),
              res.obj[pickType] && res.obj[pickType](evt, res.obj);
          },
        },
        {
          key: "getRandomId",
          value: function () {
            return (
              new Date().getTime() +
              "" +
              Math.floor(1e4 * Math.random()) +
              Math.floor(1e4 * Math.random())
            );
          },
        },
      ]),
      CustomHandler
    );
  })(),
  MapViewer = (function () {
    function MapViewer(domId, opt, success) {
      _classCallCheck(this, MapViewer),
        domId &&
          ((this.domId = domId),
          (this.opt = opt || {}),
          (domId = document.getElementById(this.domId)) &&
            !domId.style.position &&
            (domId.style.position = "relative"),
          (this._viewer = null),
          (this.baseLayerTool = null),
          (this.operateLayerTool = null),
          (this.operatePlotTool = null),
          (this.rightTool = null),
          (this.lnglatNavigation = null),
          (this.compassTool = null),
          (this.popupTooltipTool = null),
          (this._viewer = this.createViewer()),
          this.opt.map.terrain.show &&
            this.loadTerrain(this.opt.map.terrain.url),
          this.loadbaseLayers(),
          this.loadOperateLayers(),
          this.opt.map.lnglatNavigation && this.openLnglatNavigation(),
          this.opt.map.rightTool && this.openRightTool(),
          this.openPopupTooltip(),
          this.opt.map.navigationTool && this.openNavigationTool(),
          this.opt.map.worldAnimate
            ? this.openWorldAnimate()
            : this.opt.map.cameraView &&
              util$1.setCameraView(this.opt.map.cameraView, this._viewer),
          this.opt.map.errorRender &&
            this._viewer.scene.renderError.addEventListener(function () {
              window.location.reload();
            }, this),
          (this._viewer.scene.debugShowFramesPerSecond =
            this.opt.map.debugShowFramesPerSecond),
          null != this.opt.map.brightness &&
            ((opt = this._viewer.scene.postProcessStages),
            (this._viewer.scene.brightness =
              this._viewer.scene.brightness ||
              opt.add(Cesium.PostProcessStageLibrary.createBrightnessStage())),
            (this._viewer.scene.brightness.enabled = !0),
            (this._viewer.scene.brightness.uniforms.brightness = Number(
              this.opt.map.brightness
            ))),
          (null != this.opt.autoBindHandler && !this.opt.autoBindHandler) ||
            ((domId = new CustomHandler(this._viewer)).click(),
            domId.mouseMove(),
            domId.rightClick()),
          success && success(this));
    }
    var _loadTerrain;
    return (
      _createClass(MapViewer, [
        {
          key: "viewer",
          get: function () {
            return this._viewer;
          },
        },
        {
          key: "createViewer",
          value: function () {
            var viewerAttr = this.opt.map.viewer,
              viewerAttr = new window.Cesium.Viewer(this.domId, viewerAttr);
            return (
              viewerAttr.imageryLayers.removeAll(),
              (viewerAttr._cesiumWidget._creditContainer.style.display =
                "none"),
              (viewerAttr.mapConfig = this.opt),
              viewerAttr.cesiumWidget.screenSpaceEventHandler.removeInputAction(
                Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
              ),
              (viewerAttr.scene.globe.depthTestAgainstTerrain =
                this.opt.map.depthTestAgainstTerrain),
              viewerAttr
            );
          },
        },
        {
          key: "loadbaseLayers",
          value: function () {
            var baseLayers = this.opt.baseLayers,
              baseServer = this.opt.baseServer || "";
            if (baseLayers) {
              this.baseLayerTool ||
                (this.baseLayerTool = new LayerTool(this._viewer));
              for (var i = 0; i < baseLayers.length; i++) {
                var layer = baseLayers[i];
                if (!layer.type)
                  return void console.log("缺少基础图层的图层类型", layer);
                "group" != layer.type &&
                  ((layer.id =
                    layer.id ||
                    new Date().getTime() +
                      "" +
                      Number(1e3 * Math.random()).toFixed(0)),
                  layer.url &&
                    (layer.url = layer.url.replace(
                      "${baseServer}",
                      baseServer
                    )),
                  this.baseLayerTool.add(layer));
              }
            }
          },
        },
        {
          key: "loadOperateLayers",
          value: function () {
            var operateLayers = this.opt.operateLayers;
            if (operateLayers)
              for (
                var allOperateLayers = [],
                  baseServer =
                    (!(function dg(layers) {
                      for (var i = 0; i < layers.length; i++) {
                        var layer = layers[i];
                        (layer.id =
                          layer.id ||
                          new Date().getTime() +
                            "" +
                            Number(1e3 * Math.random()).toFixed(0)),
                          (layer.alpha = null == layer.alpha ? 1 : layer.alpha),
                          layer.children && 0 < layer.children.length
                            ? dg(layer.children)
                            : allOperateLayers.push(layer);
                      }
                    })(operateLayers),
                    this.opt.baseServer || ""),
                  i = 0;
                i < allOperateLayers.length;
                i++
              ) {
                var layer = allOperateLayers[i];
                if (!layer.type)
                  return void console.log("缺少基础图层的图层类型", layer);
                "group" != layer.type &&
                  ("plot" == layer.type && layer.show
                    ? (this.operatePlotTool ||
                        (this.operatePlotTool = new DrawTool(this._viewer, {
                          canEdit: !1,
                        })),
                      (layer.type = layer.plotType),
                      this.operatePlotTool.createByPositions(layer))
                    : (layer.url &&
                        (layer.url = layer.url.replace(
                          "${baseServer}",
                          baseServer
                        )),
                      this.operateLayerTool ||
                        (this.operateLayerTool = new LayerTool(this._viewer)),
                      this.operateLayerTool.add(layer)));
              }
          },
        },
        {
          key: "loadTerrain",
          value:
            ((_loadTerrain = _asyncToGenerator(
              _regeneratorRuntime().mark(function _callee(url) {
                var terrainProvider;
                return _regeneratorRuntime().wrap(
                  function (_context) {
                    for (;;)
                      switch ((_context.prev = _context.next)) {
                        case 0:
                          if (url) {
                            _context.next = 2;
                            break;
                          }
                          return _context.abrupt("return");
                        case 2:
                          return (
                            (this._viewer.scene.terrainProvider =
                              new Cesium.EllipsoidTerrainProvider({})),
                            (_context.next = 5),
                            Cesium.CesiumTerrainProvider.fromUrl(url)
                          );
                        case 5:
                          (terrainProvider = _context.sent),
                            (this._viewer.scene.terrainProvider =
                              terrainProvider);
                        case 7:
                        case "end":
                          return _context.stop();
                      }
                  },
                  _callee,
                  this
                );
              })
            )),
            function (_x) {
              return _loadTerrain.apply(this, arguments);
            }),
        },
        {
          key: "setTerrainVisible",
          value: function (visible) {
            (this._viewer.scene.terrainProvider =
              new Cesium.EllipsoidTerrainProvider()),
              visible &&
                this.loadTerrain(
                  null == (visible = this.opt.map.terrain)
                    ? void 0
                    : visible.url
                ),
              this._viewer.scene.render();
          },
        },
        {
          key: "openRightTool",
          value: function () {
            this.rightTool ||
              (this.rightTool = new RightTool(this._viewer, {}));
          },
        },
        {
          key: "closeRightTool",
          value: function () {
            this.rightTool &&
              (this.rightTool.destroy(), (this.rightTool = null));
          },
        },
        {
          key: "openPopupTooltip",
          value: function () {
            this.popupTooltip ||
              ((this.popupTooltip = new PopupTooltipTool(this._viewer, {})),
              this.popupTooltip.bindTooltip(),
              this.popupTooltip.bindPopup());
          },
        },
        {
          key: "closePopupTooltip",
          value: function () {
            this.popupTooltip &&
              (this.popupTooltip.destroy(), (this.popupTooltip = void 0));
          },
        },
        {
          key: "openLnglatNavigation",
          value: function () {
            this.lnglatNavigation ||
              (this.lnglatNavigation = new LnglatTool(this._viewer));
          },
        },
        {
          key: "closeLnglatNavigation",
          value: function () {
            this.lnglatNavigation &&
              (this.lnglatNavigation.destroy(), (this.lnglatNavigation = null));
          },
        },
        {
          key: "openWorldAnimate",
          value: function () {
            var that = this;
            this.setRotate(
              { x: this.opt.map.cameraView.x, y: this.opt.map.cameraView.y },
              function () {
                that.opt.map.cameraView &&
                  ((that.opt.map.cameraView.duration = 3),
                  util$1.setCameraView(that.opt.map.cameraView, that.viewer));
              }
            );
          },
        },
        {
          key: "setRotate",
          value: function (obj, callback) {
            var v, i, q, x, y, z, that, interVal;
            obj.x && obj.y
              ? ((v = obj.v || 1),
                (i = 0),
                (q = obj.q || 2),
                (x = obj.x),
                (y = obj.y),
                (z = obj.z),
                (that = this),
                (interVal = window.setInterval(function () {
                  179 <= (x += v) && ((x = -180), i++),
                    that.viewer.scene.camera.setView({
                      destination: new Cesium.Cartesian3.fromDegrees(
                        x,
                        y,
                        z || 2e7
                      ),
                    }),
                    i == q && (clearInterval(interVal), callback());
                }, 10)))
              : console.log("设定地球旋转时，并未传入经纬度！");
          },
        },
        {
          key: "openNavigationTool",
          value: function () {
            this.compassTool = new CesiumNavigation(this._viewer, {
              enableCompass: !0,
              enableZoomControls: !0,
              enableDistanceLegend: !0,
              enableCompassOuterRing: !0,
              view:
                this._viewer.mapConfig.map &&
                this._viewer.mapConfig.map.cameraView,
            });
          },
        },
        {
          key: "destroy",
          value: function () {
            this.baseLayerTool &&
              (this.baseLayerTool.destroy(), (this.baseLayerTool = null)),
              this.operateLayerTool &&
                (this.operateLayerTool.destroy(),
                (this.operateLayerTool = null)),
              this.operatePlotTool &&
                (this.operatePlotTool.destroy(), (this.operatePlotTool = null)),
              this.lnglatNavigation &&
                (this.lnglatNavigation.destroy(),
                (this.lnglatNavigation = null)),
              this._viewer && (this._viewer.destroy(), (this._viewer = null));
          },
        },
        {
          key: "openSizeListener",
          value: function (callback) {
            var that = this,
              obdom = document.getElementById(this.domId);
            new (window.MutationObserver ||
              window.webkitMutationObserver ||
              window.MozMutationObserver)(function (mutations) {
              var width = window
                  .getComputedStyle(obdom)
                  .getPropertyValue("width"),
                height = window
                  .getComputedStyle(obdom)
                  .getPropertyValue("height"),
                width = window.parseInt(width),
                height = window.parseInt(height);
              that.lnglatNavigation &&
                that.lnglatNavigation.setVisible(1e3 < width),
                that.compassTool && that.compassTool.setVisible(300 < height),
                callback && callback(width, height);
            }).observe(obdom, {
              childList: !1,
              attributes: !0,
              characterData: !1,
              subtree: !1,
            });
          },
        },
      ]),
      MapViewer
    );
  })(),
  plot = {
    Tool: DrawTool,
    Billboard: CreateBillboard,
    Circle: CreateCircle,
    Model: CreateGltfModel,
    Label: CreateLabel,
    Point: CreatePoint,
    Polygon: CreatePolygon,
    Rectangle: CreateRectangle,
    Polyline: CreatePolyline,
    Arrow: CreateArrow,
  },
  layer = {
    Tool: LayerTool,
    Arcgiscache: ArcgiscacheLayer,
    Mapserver: MapserverLayer,
    Grid: GridLayer,
    Geojson: GeojsonLayer,
    TDT: TDTLayer,
    Image: SingleImageLayer,
    TMS: TMSLayer,
    XYZ: XYZLayer,
    Tileset: TilesetLayer,
    WMS: WMSLayer,
    WMTS: WMTSLayer,
    urltemplate: UrltemplateLayer,
    Baidu: BaiduLayer,
    Tencent: TencentLayer,
    OSM: OSMLayer,
    layerload: layerload,
  },
  measure = {
    Tool: MeasureTool,
    Azimutht: MeasureAzimutht,
    GroundDistance: MeasureGroundDistance,
    Height: MeasureHeight,
    Lnglat: MeasureLnglat,
    Triangle: MeasureTriangle,
    SpaceDistance: MeasureSpaceDistance,
    SpaceArea: MeasureSpaceArea,
  },
  roam = { Tool: RoamTool, Roam: Roam },
  primitive = {
    Circle: CustomCriclePrimitive,
    Wall: CustomWallPrimitive,
    Cylinder: CustomCylinderPrimitive,
    Cone: ConePrimitive,
  },
  graphic = { TrackCylinder: TrackCylinderGraphic },
  weather = { fog: fog, snow: snow, rain: rain },
  common = {
    Navigation: CesiumNavigation,
    ZoomTool: ZoomTool,
    RightTool: RightTool,
    LnglatTool: LnglatTool,
    LayerSplit: LayerSplit,
    Cluster: Cluster,
    Prompt: Prompt$1,
    SkyboxGround: SkyboxGround,
    OverviewMap: OverviewMap,
    selectModel: selectModel,
  },
  view = {
    viewAround: viewAround,
    viewPoint: viewPoint,
    worldRotate: worldRotate,
  },
  tileset = {
    Clip: TilesetClip,
    Edit: TilesetEdit,
    PointLight: PointLight,
    Cut: TilesetCut,
    Flat: Flat,
  },
  analysis = {
    Sunshine: Sunshine,
    LimitHeight: LimitHeight,
    VisualFieldTool: visualFieldTool,
  },
  query = { GaodePOI: GaodePOI, GaodeRoute: GaodeRoute },
  cover = {
    echarts: echartMap,
    mapv: mapv,
    Heatmap: Heatmap,
    Heatmap3d: Heatmap3d,
  },
  VERSION = "1.1.1",
  vis3d_export = {
    VERSION: VERSION,
    MapViewer: MapViewer,
    sensor: sensor,
    layer: layer,
    material: material,
    layerload: layerload,
    util: util$1,
    tool: tool,
    plot: plot,
    draw: draw,
    measure: measure,
    roam: roam,
    primitive: primitive,
    graphic: graphic,
    weather: weather,
    common: common,
    view: view,
    tileset: tileset,
    analysis: analysis,
    query: query,
    cover: cover,
  };
export default vis3d_export;
